SonokoMizuki added the comment:
That's right. currently python can not distinguish positive number or negative
number.
>>> a = bin(-5,10)
>>> int(a,2)
1019
I think reason of ambiguity is decode function( int() ).
So, I suggest new decode function.
(example)
>>> b2i('0b1011',negative=True)
-5
>>> b2i('0b1011',negative=False)
11
( I do not know whether it is good to add special function for binary..., sorry)
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue25999>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com