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, bin() will return two's complement. example) >>> bin(12) '0b1100' >>> bin(-12) '-0b1100' >>> bin(-12,8) '0b11110100' >>> bin(-12,3) # if not enough bit size, bin will return value as usual. '-0b100' ---------- components: Argument Clinic messages: 257408 nosy: larry, mizuki priority: normal severity: normal status: open title: Add support of native number in bin() type: behavior versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25999> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com