E
Size: a a a
E
m
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'foo']
m
self.__class__
m
class Foo:
@classmethod
def foo(selfic):
print(dir(selfic))
Foo().foo()
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'foo']
E
m
class Foo:
def foo2(self):
print(dir(self))
@classmethod
def foo(cls):
cls.foo2()
Foo().foo()
Foo().foo2()
m
m
m
m
E
E
m
m
m
import random
class Foo:
def __len__(self):
return random.randint(0, 1000)
def __add__(self, other):
return 5
x = Foo()
print(len(x))
print(x + 5)
m
m