On 02:01 pm, [EMAIL PROTECTED] wrote:
On 10/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
As long as we're all tossing out ideas here, my 2�.  I vastly prefer
this:
>>        @property.set
to this:
>      @property.set(attribute)

I don't approve of it. It has always been and will always
continue to be my position that these are semantically unkosher,
because it means that you can't wrap them in convenience functions or
invoke them in different contexts, and that means that the semantics
are hard to explain.

Point taken.
If you really want another argument, repeating the property name
actually does have an additional use case: you can have a read-only
property with a corresponding read-write property whose name differs.

I don't actually have this use-case, but it does make the actual semantics of the provided argument a bit clearer to me. It's not an implementation detail of fusing the properties together, it's just saying which property to get the read accessor from.

This is a minor nit, as with all decorators that take an argument, it seems like it sets up a hard-to-debug error condition if you were to accidentally forget it:

   @property
   def foo(): ...
   @property.set
   def foo(): ...

would leave you with 'foo' pointing at something that wasn't a descriptor at all. Is there a way to make that more debuggable?
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to