property syntax

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Thu Mar 8 06:04:38 EST 2007


Gabriel Genellina:
> You miss this common way, that does not depend on metaclasses,
> nor base classes, nor custom decorators...

My purpose was to discuss a new syntax. The other stuff is mostly for
reference, to show that lot of (some) people has tried to find
alternative solutions to a problem they feel.


> The only drawback is the "deprecated"

I can see other drawbacks: you have to use an explicit doc = "..."
instead of a normal docstring, and you have to remember to put return
property(**locals()) at its end. I don't know if your version is
compatible with Psyco (I presume it's compatible). And I think all
those solutions can't be subclassed like I have shown in the
altenative syntax (but maybe you can find a way to modify the
metaclass version to allow this too).

Bye and thank you,
bearophile




More information about the Python-list mailing list