Enhanced property decorator

Benjamin musiccomposition at gmail.com
Tue Aug 26 22:02:05 EDT 2008


On Aug 25, 9:00 pm, Daniel <miller... at gmail.com> wrote:
> On 25 Aug, 21:52, Benjamin <musiccomposit... at gmail.com> wrote:
>
> > ... I think Python 2.6 may have
> > want you want:
>
> > class A(object):
>
> >     @property
> >     def my_prop(): return self._prop
>
> >     @my_prop.setter
> >     def my_prop(prop): self._prop = prop
>
> >     @my_prop.deleter
> >     def my_prop(): del self._prop
>
> Hmm, interesting. I wonder if it suppports setting the doc-string in a
> similar way? I'll have to look into that. Thanks for pointing this
> out.

It takes the getter's docstring as usual.
>
> ~ Daniel




More information about the Python-list mailing list