[issue25999] Add support of negative number in bin()

2016-01-03 Thread SonokoMizuki
Changes by SonokoMizuki <yahoo.co.jp...@gmail.com>: -- title: Add support of native number in bin() -> Add support of negative number in bin() ___ Python tracker <rep...@bugs.python.org> <http://bugs.pyt

[issue25999] Add support of native number in bin()

2016-01-03 Thread SonokoMizuki
New submission from SonokoMizuki: Add support of negative number in bin(). Currently, bin(-5) returns '-0b101', It is not intuitive. I think bin() should return two's complement. I suggest new bin(). New second argument is bit size. if first argument is negative number and bit size is given

[issue25999] Add support of native number in bin()

2016-01-03 Thread SonokoMizuki
SonokoMizuki added the comment: I see. I grasp to write own function is best. thanks (^-^) -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue25999] Add support of native number in bin()

2016-01-03 Thread SonokoMizuki
SonokoMizuki added the comment: It is nice solution. I can get negative number all right. thanks but, I feel bad that bin(-5) returns '-0b101' sorry -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue25999] Add support of native number in bin()

2016-01-03 Thread SonokoMizuki
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) >>>