This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add Binary module.
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.9
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: Ananthakrishnan, SilentGhost, mark.dickinson, serhiy.storchaka, tim.peters, xtreak
Priority: normal Keywords:

Created on 2020-02-16 06:46 by Ananthakrishnan, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (10)
msg362045 - (view) Author: Ananthakrishnan (Ananthakrishnan) * Date: 2020-02-16 06:46
Add binary module that has binary operations like:

binary addition.
binary subtracion.
binary multiplication.
binary division.
compliment.
1's complement.
2's complement.
cconverting to various number system.
converting to BCD.
converting to grey code.
K-Map function

and so on..
msg362046 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2020-02-16 07:26
For binary addition and subtraction is it any different from https://docs.python.org/3/library/operator.html . Is there a PyPI package that implements these ideas to see how useful it already is?
msg362051 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-02-16 08:12
What is binary addition, how it differs from just addition, what type of objects it operates?
msg362053 - (view) Author: Ananthakrishnan (Ananthakrishnan) * Date: 2020-02-16 08:35
It is "addition". I meant binary addition:

1110+1010=11000.
1111-1000=0111
msg362054 - (view) Author: Ananthakrishnan (Ananthakrishnan) * Date: 2020-02-16 08:36
It operates only on 0 and 1
msg362058 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2020-02-16 09:00
Ananthakrishnan, you've marked this issue as belonging to C API component, why? Besides, all this functionality is already present in python, what is it you're actually interested in? What is not covered by the independent packages on pypi?
msg362059 - (view) Author: Ananthakrishnan (Ananthakrishnan) * Date: 2020-02-16 09:05
I meant a module for "binary number".
It can do operations on binary number.
msg362060 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2020-02-16 09:07
>>> 0b1110 + 0b1010
24
>>> bin(0b1110 + 0b1010)
'0b11000'

Can you explain how this is not enough?
msg362061 - (view) Author: Ananthakrishnan (Ananthakrishnan) * Date: 2020-02-16 09:14
I think this is not present in python.
This module should contain operations that can be performed on binary numbers.
In the below examples a and b are binary numbers.

binary.add(a,b)
binary.sub(a,b)
binary.mul(a,b)
binary.div(a,b)
binary.ones_complement(a)    //returns 1's complement of a.
binary.twos_complement(a)    //returns 2's complement of a.
binary.dectobi(a)            //converts decimal "a" to binary of "a".
binary.bcd(a)                //returns bcd of a.
binary.gray(a)               //returns grey code of a.
binary.min()                 //minimizes.
binarybitodec                //converts binar "a" to decimal of "a".
msg362062 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2020-02-16 09:15
I'm going to close this, for two reasons:

- It's not well-formed enough for a b.p.o. issue: there are too many details to be worked out and questions to be answered. As it stands, there's nothing actionable here.

- Adding a new module to the Python std. lib. would be a PEP-level change.

If you want to move this forward, please first take it to the python-ideas mailing list[1] for further discussion; it'll get a wider audience there than here, so that's a better place to hash out the details. Once the details are clearer, if people still think it's a good idea, then it would be time to start working on a PEP and reference implementation.

[1] https://mail.python.org/archives/list/python-ideas@python.org/
History
Date User Action Args
2022-04-11 14:59:26adminsetgithub: 83825
2020-02-16 09:15:31mark.dickinsonsetstatus: open -> closed
resolution: rejected
stage: resolved
2020-02-16 09:15:18mark.dickinsonsetmessages: + msg362062
2020-02-16 09:14:00Ananthakrishnansetmessages: + msg362061
2020-02-16 09:07:50SilentGhostsetmessages: + msg362060
2020-02-16 09:05:53Ananthakrishnansetmessages: + msg362059
2020-02-16 09:01:37Ananthakrishnansetcomponents: + Library (Lib), - C API
2020-02-16 09:00:25SilentGhostsetnosy: + SilentGhost
messages: + msg362058
2020-02-16 08:36:41Ananthakrishnansetmessages: + msg362054
2020-02-16 08:35:16Ananthakrishnansetmessages: + msg362053
2020-02-16 08:12:41serhiy.storchakasetmessages: + msg362051
2020-02-16 07:26:49xtreaksetnosy: + xtreak
messages: + msg362046
2020-02-16 07:04:57SilentGhostsetnosy: + Ananthakrishnan
2020-02-16 06:58:31Ananthakrishnansetnosy: + tim.peters, mark.dickinson, serhiy.storchaka, - Ananthakrishnan
2020-02-16 06:46:13Ananthakrishnancreate