[Python-Dev] Definining properties - a use case for class decorators?

Ronald Oussoren ronaldoussoren at mac.com
Mon Oct 24 13:13:45 CEST 2005

On 24-okt-2005, at 12:54, Josiah Carlson wrote:

> Metaclass abuse?  Oh, I'm sorry, I thought that the point of  
> metaclasses
> were to offer a way to make "magic" happen in a somewhat pragmatic
> manner, you know, through metaprogramming.  I would call this  
> particular
> use a practical application of standard Python semantics.

I'd say using a class statement to define a property is metaclass  
abuse, as would
anything that wouldn't define something class-like. The same is true  
for other
constructs, using an decorator to define something that is not a  
callable would IMHO
also be abuse.

That said, I really have an opinion on the 'create' statement  
proposal yet. It
does seem to have a very limited field of use. I'm quite happy with  
using property
as it is, property('get_foo', 'set_foo') would take away most if not  
all of
the remaining problems.


More information about the Python-Dev mailing list