[issue10021] Format parser is too permissive

Terry J. Reedy report at bugs.python.org
Sat Oct 9 00:55:20 CEST 2010


Terry J. Reedy <tjreedy at udel.edu> added the comment:

This is a bug report in that there is a discrepancy between the grammar in the doc and the behavior. Laxiness can lead to portability problems if CPython is lax compared to a normal reading of the spec and another implementation takes the spec seriously.

I agree that implementation details that lead to an exception here and not there, or vice versa, are best avoided.

For getattr:
'''
getattr(object, name[, default]) 
Return the value of the named attributed of object. name must be a string.
'''
the doc is careful to just say that name must be a string, not specifically an identifier. Given that, I suppose
"attribute_name    ::=  identifier" should be changed to match so that string formats can always (all implementations) also access non-identifier attributes.

----------
nosy: +terry.reedy

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10021>
_______________________________________


More information about the Python-bugs-list mailing list