Property error

Peter Otten __peter__ at web.de
Fri Dec 15 07:02:03 EST 2006


Peter Otten wrote:
 
> @decorator
> def f():
> # ...
> 
> is the same as
> 
> def f():
> # ...
> f = decorator(f())
> 
> What happens when your age() function is invoked? There is no explicit
> return statement, so None is implicitly returned, and
> 
> age = property(age())
> 
> is the same as age = property(None)

As Georg pointed out, this is all wrong. As age is not called the age
function becomes the getter.

Peter




More information about the Python-list mailing list