names as objects [was: The Descriptor Protocol...]

On Wed, Mar 2, 2011 at 4:05 AM, Martin Chilvers <martin.chilvers@gmail.com> wrote: ...
This thread (and child threads) raised similar examples, such as named properties, where varname=something('varname', ...) Is this really *only* about names, or are there other ways we might want to decorate an attribute? I assume that examples like Str() suggest a desire for more information -- and possibly more persistent information -- than just the name. Would your use cases (and the similar cases in the attribute decoration thread) be solved by making the name bindings themselves into something more than pointers? Using "<-" for "the name, not the value", would the following be helpful? class Foo: x=47 x<-type = int # But is this enforced? Same questions # as with decorators. print (x<-__name__) # __name__ probably is a little magic -jJ
participants (1)
-
Jim Jewett