Feature request: String-inferred names

Terry Reedy tjreedy at udel.edu
Thu Nov 26 13:21:49 EST 2009


Gregory Ewing wrote:
>> On Wed, 25 Nov 2009 20:44:36 -0600, The Music Guy
>> <musicguy at alphaios.net> declaimed the following in
>> gmane.comp.python.general:
>>
>>> 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-working.html 
>>>
> 
> I don't think getattr and setattr are used anywhere near
> frequently enough to justify special syntax.

This was my response too.

> To warrant having its own synax, a feature needs to be
> used *all the time*. If you find yourself using getattr
> and setattr that much, it's probably a symptom that
> you're abusing namespaces for things that would be
> better done using dictionaries.
> 
> (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.")
> 




More information about the Python-list mailing list