Dec. 5, 2011
11:58 a.m.
04.12.11 04:06, Nick Coghlan написав(ла):
".4d" would still raise an exception, though - I don't know of any obvious way to make two's complement notation meaningful in base 10.
Obviously, '{0:.4d}'.format(-31) == '{0:4d}'.format((-31)%10**4) == '9969'.
This would be tinkering with the behaviour of builtin, so I guess it would need a PEP?
No, no! Please, do not obfuscate Python formatting.