-1. Looks like more magic, not less, to me.

On 11/1/07, Tony Lownds <[EMAIL PROTECTED]> wrote:
>
> On Nov 1, 2007, at 10:26 AM, [EMAIL PROTECTED] wrote:
> > 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?
>
> How about this: give the property instance a method that changes a
> property from read-only to read-write.
> No parens, no frame magic. As a small bonus, the setter function would
> not have to be named the same as the
> property.
>
> class A(object):
>    @property
>    def foo(self):
>      return 1
>
>    @foo.setter
>    def set_foo(self, value):
>      print 'set:', value
>
> -Tony
>
> _______________________________________________
> 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/guido%40python.org
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
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