[Python-ideas] Negative hexes
Nick Coghlan
ncoghlan at gmail.com
Mon Dec 5 23:19:53 CET 2011
On Tue, Dec 6, 2011 at 3:15 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
>> That is, currently:
>>
>> >>> "{:.4x}".format(31)
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> ValueError: Precision not allowed in integer format specifier
>
> This is so poorly discoverable that I don't think it's worth it.
> Guido's approach looks sufficient to me.
I agree the formatting approach is way too obscure, but did you see my
later suggestion of an "as_twos_complement(bit_length)" conversion
method on int objects? (we could actually provide a more generic
version on numbers.Integer as well)
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas
mailing list