[Python-ideas] descriptors outside of classes

Nick Coghlan ncoghlan at gmail.com
Wed Mar 30 06:07:51 CEST 2011

On Wed, Mar 30, 2011 at 3:59 AM, Eric Snow <ericsnowcurrently at gmail.com> wrote:
> Here's another outlandish idea.  How about if descriptors could be used
> outside of classes.  I.e. any global or local variable could be assigned a
> descriptor object and the descriptor protocol would be respected for that
> variable.  This would be a pretty messy change, and I have no illusions that
> the idea will go anywhere.  However, would there be room for this in python?

Not really, because globals() both promises to return a normal
dictionary and to respect changes to the module globals made via that

All bets are off with locals(), but the globals() aspect already
spikes the idea, as it does many other ideas to do with speeding or
otherwise enhancing namespace lookups.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list