On 11/2/07, Duncan Booth <[EMAIL PROTECTED]> wrote: > Greg Ewing <[EMAIL PROTECTED]> wrote: > > > Fred Drake wrote: > >> @property > >> def attribute(self): > >> return 42 > >> > >> @property.set > >> def attribute(self, value): > >> self._ignored = value > > > > Hmmm... if you were allowed general lvalues as the target of a > > def, you could write that as > > > > def attribute.set(self, value): > > ... > > > Dotted names would be sufficient rather than general lvalues. > > I like this, I think it looks cleaner than the other options, especially if > you write both getter and setter in the same style: > > attribute = property() > > def attribute.fget(self): > return 42 > > def attribute.fset(self, value): > self._ignored = value
Sorry, you have just entered Python 4000 territory. -- --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