On 2/20/2018 12:06 PM, Guido van Rossum wrote:
Looking at https://en.wikipedia.org/wiki/Number it seems that Integer is
"special" -- every other number type is listed as " numbers"
(e.g. rational numbers, complex numbers) but integers are listed as
"Integers". So let's just switch it to that,
On Mon, Feb 19, 2018 at 5:58 AM, Sylvain MARIE
> wrote:
By the way, is there a reason for the name "Integral" (algebraic
theory) instead of "Integer" (computer science) ? Would it be
practically
: Sylvain MARIE <sylvain.ma...@schneider-electric.com>; Python-Ideas
<python-ideas@python.org>
Objet : Re: [Python-ideas] Boolean ABC similar to what's provided in the
'numbers' module
Guido van Rossum writes:
> Hm, perhaps Integral is an adjective, just like Boolean?
I
Looking at https://en.wikipedia.org/wiki/Number it seems that Integer is
"special" -- every other number type is listed as " numbers"
(e.g. rational numbers, complex numbers) but integers are listed as
"Integers". So let's just switch it to that, and keep Integral as an alias
for backwards
Guido van Rossum writes:
> Hm, perhaps Integral is an adjective, just like Boolean?
I would guess so. This is the same idiom we use when we call
[1, 2, 3] a "truth-y".
___
Python-ideas mailing list
Python-ideas@python.org
On 20 February 2018 at 08:33, Guido van Rossum wrote:
> Hm, perhaps Integral is an adjective, just like Boolean? Though it's also
> possible that it was simply a mistake. In general I don't like adding
> aliases for different spellings -- it violates TOOWTDI. If we decide that
>
On Mon, Feb 19, 2018 at 5:58 AM, Sylvain MARIE <
sylvain.ma...@schneider-electric.com> wrote:
> > A thought just occurred to me. Maybe we should just add a Boolean class
> to numbers?
>
> That would be great indeed
>
> > It's a subclass of Integral, presumably. And normally only builtins.bool
>
15.02.18 18:27, Guido van Rossum пише:
A thought just occurred to me. Maybe we should just add a Boolean class
to numbers? It's a subclass of Integral, presumably.
Isn't bool a subclass of int only for historical reasons? I think that
if bool was in Python from the beginning, it would not be
vendredi 16 février 2018 22:42
À : gu...@python.org
Cc : Sylvain MARIE <sylvain.ma...@schneider-electric.com>; Python-Ideas
<python-ideas@python.org>
Objet : Re: [Python-ideas] Boolean ABC similar to what's provided in the
'numbers' module
Sent from my iPhone
> A thought just
Sent from my iPhone
> A thought just occurred to me. Maybe we should just add a Boolean class to
> numbers?
This makes lots of sense to me.
Bool is a subclass of int — might as well embrace that fact.
-CHB
___
Python-ideas mailing list
> *De :* Guido van Rossum [mailto:gvanros...@gmail.com]
> *Envoyé :* mercredi 14 février 2018 17:14
> *À :* Sylvain MARIE <sylvain.ma...@schneider-electric.com>
> *Cc :* Python-Ideas <python-ideas@python.org>
>
> *Objet :* Re: [Python-ideas] Boolean ABC similar to what's pr
On Wed, Feb 14, 2018 at 5:49 PM, Chris Barker - NOAA Federal <
chris.bar...@noaa.gov> wrote:
> >
> > So as long as you are not expecting to ever need mypy you should be fine
> -- however if you're sharing code at some point someone is probably going
> to want to point mypy at it.
>
> mypy isn’t
>
> So as long as you are not expecting to ever need mypy you should be fine --
> however if you're sharing code at some point someone is probably going to
> want to point mypy at it.
mypy isn’t an “official” tool, but PEP484 is — and mypy is more or
less a reference implimentation, yes?
mypy
type hinting is also the use case for which I make extensive use
> of the types from the ‘numbers’ package, for the same reasons.
>
>
>
> Sylvain
>
>
>
> *De :* Python-ideas [mailto:python-ideas-bounces+sylvain.marie=schneider-
> electric@python.org] *De la part d
Python-ideas] Boolean ABC similar to what's provided in the
'numbers' module
I am mystified how you can be using the numbers package with mypy. Example:
import numbers
def f(a: numbers.Integral, b: numbers.Integral) -> numbers.Integral:
return a + b
f(12, 12)
This gives an two errors on the
ain.marie=schneider-
> electric@python.org] *De la part de* David Mertz
> *Envoyé :* mardi 13 février 2018 07:08
> *À :* Nick Coghlan <ncogh...@gmail.com>
> *Cc :* python-ideas <python-ideas@python.org>
> *Objet :* Re: [Python-ideas] Boolean ABC similar to what's provide
: Nick Coghlan <ncogh...@gmail.com>
Cc : python-ideas <python-ideas@python.org>
Objet : Re: [Python-ideas] Boolean ABC similar to what's provided in the
'numbers' module
I'm not sure I'm convinced by Sylvain that Boolean needs to be an ABC in the
standard library; Guido expresse
es+sylvain.marie=schneider-
electric@python.org] *De la part de* Chris Barker
*Envoyé :* mardi 13 février 2018 21:12
*À :* David Mertz <me...@gnosis.cx>
*Cc :* python-ideas <python-ideas@python.org>
*Objet :* Re: [Python-ideas] Boolean ABC similar to what's provided in the
'numbers'
de Chris Barker
Envoyé : mardi 13 février 2018 21:12
À : David Mertz <me...@gnosis.cx>
Cc : python-ideas <python-ideas@python.org>
Objet : Re: [Python-ideas] Boolean ABC similar to what's provided in the
'numbers' module
On Mon, Feb 12, 2018 at 10:07 PM, David Mertz
<me...@gnos
On Mon, Feb 12, 2018 at 10:07 PM, David Mertz wrote:
> I'm not sure I'm convinced by Sylvain that Boolean needs to be an ABC in
> the standard library; Guido expresses skepticism. Of course it is possible
> to define it in some other library that actually needs to use
>
I'm not sure I'm convinced by Sylvain that Boolean needs to be an ABC in
the standard library; Guido expresses skepticism. Of course it is possible
to define it in some other library that actually needs to use
`isinstance(x, Boolean)` as Sylvain demonstraits in his post. I'm not sure
I'm
On 13 February 2018 at 02:14, David Mertz wrote:
> NumPy np.bool_ is specifically not a subclass of any np.int_. If it we're,
> there would be an ambiguity between indexing with a Boolean array and an
> array of ints. Both are meaningful, but they mean different things (mask vs
NumPy np.bool_ is specifically not a subclass of any np.int_. If it we're,
there would be an ambiguity between indexing with a Boolean array and an
array of ints. Both are meaningful, but they mean different things (mask vs
collection of indices).
Do we have other examples a Python ABC that
TBH I've found the numeric tower a questionable addition to Python's
stdlib. For PEP 484 we decided not to use it (using the concrete types,
int, float etc. instead). So I'm not excited about adding more like this,
especially since essentially *everything* can be used in a Boolean context.
If
On Mon, Feb 12, 2018 at 09:41:04AM +, Sylvain MARIE wrote:
> The numbers module provides very useful ABC for the 'numeric tower',
> able to abstract away the differences between python primitives and
> for example numpy primitives.
> I could not find any equivalent for Booleans.
> However
The numbers module provides very useful ABC for the 'numeric tower', able to
abstract away the differences between python primitives and for example numpy
primitives.
I could not find any equivalent for Booleans.
However numpy defines np.bool too, so being able to have an abstract Boolean
class
26 matches
Mail list logo