[Python-ideas] Decorators for variables

Chris Angelico rosuav at gmail.com
Sun Apr 3 02:32:56 EDT 2016

On Sun, Apr 3, 2016 at 4:05 PM, Matthias welp <boekewurm at gmail.com> wrote:
> While keeping the '.__dict__' override method open, the way things work
> currently won't change that much, but it will make the assignment of
> attributes or variables with descriptor properties a lot more intuitive, as
> you do not set a *name* to a variable and then can undo that just a while
> later:
> var = property(setter, getter, deleter, docs)
> var = 20
> currently changes behaviour depending on what kind of scope it is located in
> (class description, any other scope), while decorators (for functions at
> least) work in every scope I can think of. I think that is strange, and that
> it should just be the same everywhere.

Can you explain - or, preferably, demonstrate - the difference you're
talking about here?


More information about the Python-ideas mailing list