Feature request: String-inferred names

Lie Ryan lie.1296 at gmail.com
Sat Nov 28 10:07:27 CET 2009

On 11/28/2009 3:08 PM, The Music Guy wrote:
> As for your code, I haven't seen it, so it would be hard for me to say
> exactly how the new syntax would come into play. What I can tell you,
> however, is that the parts of your code that would use it would
> probably be easier to read and change to anyone with a firm grasp of
> the proposed syntax.

Isn't this much easier to read and grasp?

obj.d["my_%s" % foo] += 3

doesn't need new syntax as well.

> Even if this sort of thing only needed to happen a few times in an
> entire project, the project as a whole could only benefit from it. My
> projects rely on a lot of metaclassing for the automatic generation of
> properties and methods, which saves tremendous amounts of coding.

If you use it a lot, it is likely 1) you have abused class syntax for 
what should have been a dict or 2) what you need is to override 
__getattr__/__getattribute__ and __setattr__

More information about the Python-list mailing list