[Python-ideas] Negative hexes

Serhiy Storchaka storchaka at gmail.com
Mon Dec 5 12:58:44 CET 2011


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.




More information about the Python-ideas mailing list