[Python-ideas] Bug? Feature? setattr(foo, '3', 4) works!
Sturla Molden
sturla.molden at gmail.com
Mon Dec 22 13:43:20 CET 2014
On 19/12/14 05:27, Cem Karan wrote:
> I'd like to suggest that getattr(), setattr(), and hasattr() all be modified so that syntactically invalid statements raise SyntaxErrors.
I'd like to object! This would break a lot of code that depends on HD5
and NetCDF databases, e.g. PyTables.
Often we can do
table.x
but sometimes we need to do
getattr(table,'some long field name')
A lot of scientific software depends on this, and it would break at the
moment your proposal is introduced. It would be a major disaster. It
would even set back NASA's space program (no kidding!)
Sturla
More information about the Python-ideas
mailing list