Terry J. Reedy <tjre...@udel.edu> added the comment: Whoops, I believe my suggested replacement. "A precision is not allowed for integer values." should really be "A precision is not allowed for integer presentation types." or something similar.
If you did not change the end of the sentence, please do. A precision *is* allowed for integer values (integers) if a float presentation type is used, because they are auto-converted (though floats are not). This is not documented but I think it should be. See #5965 for this and related suggestions. For future reference, in case anyone ever objects, I agree with remaining strict and changing the doc. 1) Given that the code is strict about the other 'only valid' restrictions (I checked some and it seems to be), it seems reasonable to be consistency strict with precision and ints also. 2) Given that there are 7 presentation types for int and 8 for floats, it is easily possible to make an error. Best to catch it early. The only possible use case I can think of for precision with ints is something like '{0:10.3{1}}'.format(val, typ) # fails for int typs but we fail-proof that, we should also fail-proof '#' with floats: '{0:#10{1}}'.format(val, typ)# fails for float typs ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5963> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com