Re: method to create class property

2008-03-19 Thread Diez B. Roggisch
> Isn't that:: > > > > @propset(foo) > > def foo(self, value): > > self._value = value Yeah, you are right. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: method to create class property

2008-03-18 Thread Alan Isaac
Diez B. Roggisch wrote: > In python 3.0, there will be an even nicer way - propset: > @property > def foo(self): > return self._foo > @propset > def foo(self, value): > self._value = value Isn't that:: @propset(foo) def foo(self, value): self._value = valu

Re: method to create class property

2008-03-18 Thread Diez B. Roggisch
Joe P. Cool schrieb: > On 18 Mrz., 21:59, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> Joe P. Cool schrieb: >>> def _property_y(self): >>> def _get(self): >>> [...] >> There are a few recipies, like this: >> >> class Foo(object): >> >> @apply >> def foo(): >>

Re: method to create class property

2008-03-18 Thread Joe P. Cool
On 18 Mrz., 21:59, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Joe P. Cool schrieb: > >     def _property_y(self): > >         def _get(self): > >             [...] > > There are a few recipies, like this: > > class Foo(object): > >     [EMAIL PROTECTED] >      def foo(): >          def fget(se

Re: method to create class property

2008-03-18 Thread Diez B. Roggisch
Joe P. Cool schrieb: > Hi, > > I like C#'s style of defining a property in one place. Can the > following way > to create a property be considered reasonable Python style (without > the > print statements, of course)? > > class sample(object): > def __init__(self): > sample.y = self.