[Python-ideas] Assignment decorators (Re: The Descriptor Protocol...)
jimjjewett at gmail.com
Thu Mar 10 16:46:32 CET 2011
On Wed, Mar 9, 2011 at 7:52 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Jim Jewett wrote:
>> Though I personally suspect that if the name of the variable is
>> needed, it is really a slot rather than a discardable name, and it
>> really *should* be a slightly different object -- a decorable pointer
>> instead of just a pointer.
> If you mean that the thing passed in as the name should be
> some object other than a string, can you provide a use case?
No, I mean that the name itself should be more than just a pointer to
It should of course *include* a pointer to an object (the bound
value), but it should *also* have its own independent existence,
regardless of whatever it happens to be pointing to. Effectively, it
should be a proxy object, rather than a simple pointer. That way, the
pointer-holder can be constrained (e.g., hold only a string) or asked
for its name, or annotated with documentation, or ...
More information about the Python-ideas