Guido van Rossum wrote:
> On Thu, Feb 20, 2020 at 01:39 Steve Jorgensen ste...@stevej.name wrote:
> > It seems to me that this could simply be a package on
> > pypi rather than
> > being added to the Python standard library.
> > Sure. But the interesting part is how to design the API. I’ve seen a
On Thu, Feb 20, 2020 at 01:39 Steve Jorgensen wrote:
> It seems to me that this could simply be a package on pypi rather than
> being added to the Python standard library.
>
Sure. But the interesting part is how to design the API. I’ve seen a number
of interesting ideas in this thread.
--
It seems to me that this could simply be a package on pypi rather than being
added to the Python standard library.
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
On Feb 17, 2020, at 04:09, ananthan ananthan
wrote:
>
> 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).
Just float, or any type convertible to int?
The module should also support bit masking (left or right justified) with
AND / OR / XOR / NotAND / NotOR / NotXOR operations.
ieg following the same structure:
binary.AND(a,b)
binary.OR(a,b)
binary.XOR(a,b)
binary.NOTAND(a,b)
binary.NOTOR(a,b)
binary.NOTXOR(a,b)
The number of larger length of
The module should also support bit masking (left and/or right justified)
with AND / OR / XOR / NotAND / NotOR / NotXOR operations.
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
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
On 2/17/20 7:08 AM, ananthan ananthan wrote:
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
I would expect this to be an error, as
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
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
> On Feb 16, 2020, at 05:24, ananthakrishnan15.2...@gmail.com wrote:
>
> This module should contain operations that can be performed on binary
> numbers.
I think you have two problems here.
The first is that you’re confusing integer values with integer literal syntax.
It’s not just that
> On 16 Feb 2020, at 17:49, ananthan ananthan
> wrote:
>
> 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".
There is no such thing as an 'integers with base designator
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.
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
On Mon, Feb 17, 2020 at 3:40 AM Mark Dickinson wrote:
>
> ananthakrishnan15.2001@gmail.com wrote:
> > binary.twos_complement(0b0011)==1101
> > binary.twos_complement(0b0011)==1101
>
> How would you make that possible, when `0b0011` and `0b0011` are the
> exact same integer?
Easy:
a and b should be integer with base designator "b" (0b110011) .OR there should
be a_new_ Python type that represents a "binary number",which accepts number of
bits,sign of number.
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe
Then can we use a new Python type that represents a "binary number",which
accepts number of bits,sign of
number.
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
ananthakrishnan15.2001@gmail.com wrote:
> binary.twos_complement(0b0011)==1101
> binary.twos_complement(0b0011)==1101
How would you make that possible, when `0b0011` and `0b0011` are the exact
same integer?
___
Python-ideas mailing list --
binary.twos_complement(0b0011)==1101
binary.twos_complement(0b0011)==1101
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
> On 16 Feb 2020, at 09:38, ananthakrishnan15.2...@gmail.com wrote:
>
> This module should contain operations that can be performed on binary numbers.
> In the below examples a and b are binary numbers.
Assuming you mean that a "binary number" is int then python
can do what you want I think.
wea are using 0b1101100002.
hence it will give you a syntax error.
___
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/
ananthakrishnan15.2001@gmail.com wrote:
> we can use 0b1100 instead of 1100.Then the output of
> binary.twos_complement(0b1100) will be 0b0100
That would be printed as `4`. Is that what you want?
Supposing we accept that `binary.twos_complement(0b1100) == 0b0100`. What would
I meant we should use base designator(1b110011).
___
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
What would you expect ones_complement(1100) to return? (I'm guessing you'd
expect a Python int with value 11.)
What about ones_complement(1100)? (I'm guessing that you'd also expect a
Python int with value 11 here.)
What would ones_complement(ones_complement(1100)) be?
What would
On Sun, 16 Feb 2020 at 16:07, wrote:
>
> what about
> >>binary.ones_complement(0b110011)
>
> or should we use something like "bitstring".
https://pypi.org/project/bitstring/
Paul
___
Python-ideas mailing list -- python-ideas@python.org
To
what about
>>binary.ones_complement(0b110011)
or should we use something like "bitstring".
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
What is 110011 here? A number written in decimal where you want to
interpret digits as binary digits?
Why don't you use 0b110011 to have a litteral written in binary
representation?
Le dim. 16 févr. 2020 à 16:32, a écrit :
>
> I'll show the example using one's and two's complement.
>
ananthakrishnan15.2001@gmail.com wrote:
> >>> binary.ones_complement(1101100001)
> 0010011110
I see. So you want `binary.ones_complement` to accept a nonnegative Python
`int` whose decimal expansion consists entirely of ones and zeros, interpret
that decimal expansion as though it's a
On Sun, 16 Feb 2020 at 15:34, wrote:
>
> I'll show the example using one's and two's complement.
> >>binary.ones_complement(110011)
> 001100
But these aren't standard Python types - well, technically, 110011
is 1,100,111,111 - 1 billion, 100 million 111 thousand one hundred and
16.02.20 17:21,
ananthakrishnan15.2...@gmail.com пише:
I'll show the example using one's and two's complement.
binary.ones_complement(1101100001)
0010011110
binary.twos_complement(1101100001)
001001
What is the type of the result of binary.ones_complement() and
I'll show the example using one's and two's complement.
>>binary.ones_complement(110011)
001100
>>binary.twos_complement(110011)
001101
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to
we can use int(eg:110011),using base designator(eg:b,B).
___
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
I'll show the example using one's and two's complement.
>>binary.ones_complement(1101100001)
0010011110
>>binary.twos_complement(1101100001)
001001
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email
ananthakrishnan15.2001@gmail.com wrote:
> I'm proposing a module that has functions intended to work with existing
> python
> types.
Okay, great. *Which* Python types, specifically? `int`? `bytes`?
To help us understand, please can you show example inputs to and output from
your proposed
I'm proposing a module that has functions intended to work with existing python
types.
Digital electronics is completely based on "binary number system".As python is
used in almost all fields,by adding a seperate module for binary containing
operations like ones complement and twos complement
And what do you call "decimal numbers"? Decimal representation of
numbers like returned by str(123456)?
Le dim. 16 févr. 2020 à 15:00, Mark Dickinson
a écrit :
>
> ananthakrishnan15.2001@gmail.com wrote:
> > In the below examples a and b are binary numbers.
>
> Please can you clarify what this
ananthakrishnan15.2001@gmail.com wrote:
> In the below examples a and b are binary numbers.
Please can you clarify what this means, in Python terms? Are you proposing a
_new_ Python type that represents a "binary number", or is `binary.add` (for
example) intended to work with existing Python
37 matches
Mail list logo