[Python-ideas] Re: Add Binary module.

2020-02-17 Thread ananthan ananthan
I want >>BinaryInt(-2, 4) 0b1110 >>BinaryInt(-2, 4, True) -0b010 >>BinaryInt(-0b010, 4) 0b1110 It should accept float values also. Can anyone tell what should be the input and return types??? ___ Python-ideas mailing list -- python-ideas@python.org To u

[Python-ideas] Re: Add Binary module.

2020-02-17 Thread ananthan ananthan
At last found what I was trying to convey. A new class>>BinaryInt(n: Integer *, bits,signed=False) It should accept float values.(now >> "bin(5.8)".. will raise an error). >>BinaryInt(-2,4) 0b1110 >>BinaryInt(5,4) 0b0101 >>BinaryInt(-2,4,True) -0b010

[Python-ideas] Re: Add Binary module.

2020-02-17 Thread ananthan ananthan
It should accept float,int values . ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.py

[Python-ideas] Re: Add Binary module.

2020-02-16 Thread ananthan ananthan
But there is a problem with (0b1101). 5==0b101 -5==-0b101 but we want output -5==1011. so this is not possible by using integers with base designator "0b". so we have to use new Python type that represents a "binary number",which accepts number of bits,sign of number. _

[Python-ideas] Re: Add Binary module.

2020-02-16 Thread ananthan ananthan
But there is a problem with (0b1101). 5==0b101 -5==-0b101 but we want output -5==1011. so this is not possible by using integers with base designator "0b". ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-