'property' builtin does not work for me

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri May 2 17:48:54 EDT 2008


En Fri, 02 May 2008 18:29:57 -0300, Alex Fainshtein  
<alex_fainshtein at netzero.net> escribió:

> Question: what I am doing wrong? Here, I am defining class with property
> member:
>
> class Test:
>
>     def getter(self):
>         print "Getter called."
>         return 'a'
>
>     def setter(self, val):
>         print "Setter called."
>
>     prop = property(getter, setter)

property requires a new-style class; change the first line to class  
Test(object):
http://docs.python.org/lib/built-in-funcs.html#l2h-57

-- 
Gabriel Genellina




More information about the Python-list mailing list