Feature request: String-inferred names

Gregory Ewing greg.ewing at canterbury.ac.nz
Fri Nov 27 02:49:54 CET 2009

The Music Guy wrote:

> As for it not being useful enough to justify new syntax, well, I think
> Ben showed pretty well that it actually is. Approximately 600 uses of
> the get*r functions were used in the Python 2.5 standard library
> alone.

The standard library isn't necessarily representative of
Python code in general. I just looked at three of my
projects, and out of a total of 45954 lines (about half
the size of the stdlib) I found only 37 uses of getattr
and setattr.

Also, many of the uses of getattr in the std lib appear
to be of the 3-argument form, which your suggested syntax
doesn't cover. If I exclude those from my code, I'm left
with only 18 uses.

So I would only be able to use your syntax in about
0.04% of the lines of code that I typically write.


More information about the Python-list mailing list