[issue32886] new Boolean ABC in numbers module

2018-04-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: > If I get you correctly, then the minimal `Boolean` ABC would only need > to contain the `__bool__` method, without the bitwise operations Once reduced to just having `__bool__`, I think there is no value added and would

[issue32886] new Boolean ABC in numbers module

2018-04-17 Thread Sylvain Marie
Sylvain Marie added the comment: Mark I get your point. Mine is just to have a common abstraction between python's primitive bool and numpy bool (and possibly other future alternate booleans) for consistency with `numbers` and to be used in common type

[issue32886] new Boolean ABC in numbers module

2018-02-24 Thread R. David Murray
Change by R. David Murray : -- nosy: +r.david.murray ___ Python tracker ___ ___

[issue32886] new Boolean ABC in numbers module

2018-02-23 Thread Mark Dickinson
Mark Dickinson added the comment: > and a minimal representation of boolean logic operations that will seem > natural to anyone, don't you think ? I'm afraid I don't. :-( Issue 1: this ABC doesn't seem a good match for Python bools. If I have a bool-like object in a

[issue32886] new Boolean ABC in numbers module

2018-02-22 Thread Sylvain Marie
Change by Sylvain Marie : Added file: https://bugs.python.org/file47457/proposal.py ___ Python tracker ___

[issue32886] new Boolean ABC in numbers module

2018-02-22 Thread Sylvain Marie
Sylvain Marie added the comment: @Mark : the '__invert__' method is out of the game since Josh comment (and my reply https://bugs.python.org/issue32886#msg312478 ) So the remaining operations *are* an abstraction of both python bool and numpy bool_

[issue32886] new Boolean ABC in numbers module

2018-02-21 Thread Mark Dickinson
Mark Dickinson added the comment: Adjusted title (since the Integer <-> Integral rename is the subject of a separate issue) and versions (since as a new feature, this can't go into Python 3.7, which is already in feature freeze). -- title: new Boolean ABC in

[issue32886] new Boolean ABC in numbers module + Integral>Integer renaming

2018-02-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Use <= for this operation. -- ___ Python tracker ___

[issue32886] new Boolean ABC in numbers module + Integral>Integer renaming

2018-02-21 Thread Mark Dickinson
Mark Dickinson added the comment: > This one is common to both python bool and np.bool_. It's not, though. One of my examples was using `~` (`__invert__`) from the proposed ABC). And the behaviour of that function differs between NumPy and Python I think one of the rules

[issue32886] new Boolean ABC in numbers module + Integral>Integer renaming

2018-02-21 Thread Sylvain Marie
Sylvain Marie added the comment: @Mark: you are right. That's why the proposed ABC does NOT inherit from Integral/Integer and focuses on boolean logic in its simplest form (not, and, or, xor). This one is common to both python bool and np.bool_. @Serhiy:

[issue32886] new Boolean ABC in numbers module + Integral>Integer renaming

2018-02-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If a Boolean ABC includes __and__, __or__ and __xor__ which implement conjunction, disjunction and exclusive disjunction, shouldn't it include __le__, __gt__, __ge__ and __lt__? They implement other logical operations: material

[issue32886] new Boolean ABC in numbers module + Integral>Integer renaming

2018-02-21 Thread Mark Dickinson
Mark Dickinson added the comment: > - register numpy bool ('np.bool_') as a virtual subclass of 'Boolean' only Be aware that np.bool_ behaves differently from Python's bool type in a number of ways. It may not make sense to have something that tries to abstract over both

[issue32886] new Boolean ABC in numbers module + Integral>Integer renaming

2018-02-21 Thread Sylvain Marie
Sylvain Marie added the comment: Thanks ! 1. > ok 2. > ok 3. > That's simply 'the latest state' in the discussion. I guess that having Boolean in numbers is better than it being in its own module, since it is consistent with the other ABCs (and bool is a

[issue32886] new Boolean ABC in numbers module + Integral>Integer renaming

2018-02-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: First off, link to discussion: https://groups.google.com/d/topic/python-ideas/-3QW3cxj3ko/discussion 1. bool is already a virtual subclass of Integral since it's an actual subclass of int (which is a virtual subclass of

[issue32886] new Boolean ABC in numbers module + Integral>Integer renaming

2018-02-20 Thread Sylvain Marie
New submission from Sylvain Marie : This issue is created following the discussion [Python-ideas] Boolean ABC similar to what's provided in the 'numbers' module. The following items are suggested: - adding a 'Boolean' ABC class to the 'numbers' module -