[Python-Dev] Definining properties - a use case for class decorators?
Antoine Pitrou
solipsis at pitrou.net
Sun Oct 16 16:08:09 CEST 2005
> class Demo(object):
> @def_property
> class test:
> """This is a test property"""
> def get(self):
> print "Getting attribute on instance"
> def set(self, value):
> print "Setting attribute on instance"
> def delete(self):
> print "Deleting attribute on instance"
The code looks like "self" refers to a test instance, but it will
actually refer to a Demo instance. This is quite misleading.
More information about the Python-Dev
mailing list