F
Fredp
Hi
I was wondering if it is possible to have the various magic methods,
mainly __getattr__ and __setattr__, and @property attributes called
when accessing the attribute of a non-intantiated class.
Imagin something like this:
#####
class MyClass:
@property
def prop(self):
print "Accessed"
return "ABCD"
print MyClass.prop
#####
having it printing:
#####
Accessed
ABCD
#####
Thanks very much
I was wondering if it is possible to have the various magic methods,
mainly __getattr__ and __setattr__, and @property attributes called
when accessing the attribute of a non-intantiated class.
Imagin something like this:
#####
class MyClass:
@property
def prop(self):
print "Accessed"
return "ABCD"
print MyClass.prop
#####
having it printing:
#####
Accessed
ABCD
#####
Thanks very much