Feature request: String-inferred names
Raymond Hettinger
python at rcn.com
Tue Dec 1 13:21:03 EST 2009
[Gregory Ewing]
> >>I just posted to my blog about a feature that I'd like to see added to
> >>Python.
>
> >>http://alphaios.blogspot.com/2009/11/python-string-inferred-names-wor...
>
> I don't think getattr and setattr are used anywhere near
> frequently enough to justify special syntax.
Perhaps that would change if we had the proposed syntax.
I would expect that powerful and expressive idioms would emerge.
> (A frequent question asked by newcomers from certain
> other kinds of languages is something like "How do I
> assign to a variable whose name is in another variable?"
> The answer is almost always "Don't do that, use a
> dictionary.")
The proposed syntax works better with class namespaces
which automatically provide inheritance logic and
method binding. Dictionaries don't provide equivalent
support.
Raymond
More information about the Python-list
mailing list