what is lambda used for in real code?

Duncan Booth duncan.booth at invalid.invalid
Sat Jan 1 06:46:01 EST 2005


Diez B. Roggisch wrote:

> The doc string of _s_item contains a token the metaclass is aware of and
> creates a wrapper around _s_item. That works nice on methods, but I found
> that properties got bound to their functions _before_ the metaclass kicks
> in, so the property wasn't called in the wrapped version, resulting in
> errors.

Why not improve your metaclass wrapping so it knows about properties and 
replaces them with properties containing wrapped functions?

That way you could avoid having to remember to write special code like 
this, and surely the whole point of using a metaclass is so that you can 
extract the special code and leave your class definition as clean as 
possible.



More information about the Python-list mailing list