[Python-Dev] Definining properties - a use case for class decorators? (original) (raw)

Barry Warsaw barry at python.org
Tue Oct 18 16:57:01 CEST 2005


On Mon, 2005-10-17 at 23:46, Guido van Rossum wrote:

But I still like the version with strings better:

x = property('getx', 'setx') This trades two lambdas for two pairs of string quotes; a good deal IMO!

You could of course "just" do the wrapping in property(). I put that in quotes because you'd have the problem of knowing when to wrap and when not to, but there would be ways to solve that. But I won't belabor the point any longer, except to ask what happens when you typo one of those strings? What kind of exception do you get and when do you get it?

-Barry

-------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 307 bytes Desc: This is a digitally signed message part Url : http://mail.python.org/pipermail/python-dev/attachments/20051018/21468041/attachment.pgp



More information about the Python-Dev mailing list