46 lines
979 B
Python
46 lines
979 B
Python
class Test:
|
|
a = [1,2,3,4,5]
|
|
|
|
a1 = 1
|
|
def __init__(self) -> None:
|
|
pass
|
|
|
|
def sentiment(self):
|
|
pass
|
|
|
|
def __getattr__(self, str):
|
|
print(f"DEBUG: attempt to access attr {str}")
|
|
if int(str[1]) > 0 and int(str[1]) < 6:
|
|
return self.a[int(str[1])]
|
|
|
|
def c():
|
|
print(f"DEBUG: {c.__self__=}")
|
|
|
|
def i(self):
|
|
pass
|
|
#print(f"DEBUG: {i.__self__=}")
|
|
|
|
class ChildTest(Test):
|
|
pass
|
|
|
|
if __name__ == '__main__':
|
|
def whoami(who):
|
|
if isinstance(Test.c(), Test):
|
|
print("It's a Test!")
|
|
if isinstance(ChildTest.c(), ChildTest):
|
|
print("It's a ChildTest!")
|
|
|
|
test = Test()
|
|
childtest = ChildTest()
|
|
test.sentiment
|
|
whoami(test)
|
|
whoami(childtest)
|
|
print(f"{test.a1}")
|
|
print(f"{hasattr(test, 'sentiment')}")
|
|
|
|
print(f"{test.c=}")
|
|
print(f"{childtest.c=}")
|
|
test.i()
|
|
|
|
#print(test['1099'][2019][3])
|
|
#print(test.1099_2019_3) |