This has turned into a rant about numpy and the scipy ecosystem -- not
relevant at all to python-ideas.
Please stop.
-CHB
On Mon, Mar 16, 2020 at 9:51 AM Marco Sulla
wrote:
> On Mon, 16 Mar 2020 at 04:51, Kyle Stanley wrote:
> > PEP 8 itself is very far from a definitive authority. Its scope
On Mon, 16 Mar 2020 at 04:51, Kyle Stanley wrote:
> PEP 8 itself is very far from a definitive authority. Its scope is
> specifically intended to cover CPython stdlib development, not all uses of
> Python.
Yes, I know. But it's a common convention, and Python relies often on
conventions. For ex
> If I could go back to 1995 or thereabouts when Python was first
> starting, I would make a clear distinction between scalar and vector
> operations, like Julia does.
>
> Borrowing Julia's syntax:
>
> a == b # compare a to b, returns True or False
> a .== b # elementwise comparison
>
>
On Thu, Mar 12, 2020 at 09:08:57AM -0700, Christopher Barker via Python-ideas
wrote:
> On Thu, Mar 12, 2020 at 5:50 AM Marco Sulla via Python-ideas <
> python-ideas@python.org> wrote:
>
> > Actually, this is the behaviour of ndarray with any dtype. And IMHO
> > ithis is quite terrible?
>
>
On Thu, 12 Mar 2020 at 17:09, Christopher Barker wrote:
>> I was so used to have False for an empty iterable
> I hate to be pedantic, but it doesn't work for iterables anyway:
Yes, I know that it does not work for iterators. This is another problem :-)
> but If I really want to know if a sequen
On Thu, Mar 12, 2020 at 5:50 AM Marco Sulla via Python-ideas <
python-ideas@python.org> wrote:
> Actually, this is the behaviour of ndarray with any dtype. And IMHO
> ithis is quite terrible?
I can see how you would think that. But the fact is that element-wise
operations are very important
On Wed, 11 Mar 2020 at 18:08, Serhiy Storchaka wrote:
> There is a precedence (although not in the stdlib): NumPy array with
> dtype=bool.
>
> >>> import numpy
> >>> bool(numpy.array([False, False]))
> Traceback (most recent call last):
> File "", line 1, in
> ValueError: The truth v
12.03.20 08:08, Ben Rudiak-Gould пише:
There are some cases in the standard library, e.g.
>>> import dbm.dumb
>>> db = dbm.dumb.open('foo')
>>> db.close()
>>> not db
Traceback (most recent call last):
File "", line 1, in
OSError: DBM object has already been closed
mmap.m
On Wed, Mar 11, 2020 at 10:09 AM Serhiy Storchaka wrote:
> There is a precedence (although not in the stdlib): NumPy array with
> dtype=bool.
>
> >>> import numpy
> >>> bool(numpy.array([False, False]))
> Traceback (most recent call last):
> File "", line 1, in
> ValueError: The trut
On Wed, Mar 11, 2020 at 07:06:20PM +0200, Serhiy Storchaka wrote:
> 11.03.20 12:39, Steven D'Aprano пише:
> >https://bugs.python.org/issue35712
> >
> >I am disappointed because, to me, it is a fundamental part of Python's
> >object model that *everything* can be interpreted as a truthy/falsey
> >ob
On 03/11/2020 11:16 AM, Andrew Barnert via Python-ideas wrote:
On Mar 11, 2020, at 02:42, Steve Jorgensen wrote:
Take the following example:
```
def __lt__(self, other):
return not self.__ge__(other):
def __le__(self, other):
return not self.__gt__(other):
def __
On Mar 11, 2020, at 02:42, Steve Jorgensen wrote:
>
> Take the following example:
>
> ```
>def __lt__(self, other):
>return not self.__ge__(other):
>
>def __le__(self, other):
>return not self.__gt__(other):
>
>def __ge__(self, other):
>
> ```
Usually you c
11.03.20 12:39, Steven D'Aprano пише:
https://bugs.python.org/issue35712
I am disappointed because, to me, it is a fundamental part of Python's
object model that *everything* can be interpreted as a truthy/falsey
object (in the absence of bugs).
NotImplemented is special. It is more special th
Guido van Rossum wrote:
> Looks like NotImplemented is widely misunderstood. It should ONLY be
> returned from binary operator overloads, like __add__.
> On Wed, Mar 11, 2020 at 03:49 jdve...@gmail.com
> wrote:
> > Steven D'Aprano wrote:
> > On Wed, Mar 11, 2020 at 09:42:15AM -, Steve
> > Jorge
Looks like NotImplemented is widely misunderstood. It should *ONLY* be
returned from binary operator overloads, like __add__.
On Wed, Mar 11, 2020 at 03:49 wrote:
> Steven D'Aprano wrote:
> > On Wed, Mar 11, 2020 at 09:42:15AM -, Steve Jorgensen wrote:
> > > I realize this is probably someth
Steven D'Aprano wrote:
> On Wed, Mar 11, 2020 at 09:42:15AM -, Steve Jorgensen wrote:
> > I realize this is probably something that would be
> > hard to change for
> > compatibility reasons. Maybe someone can think of a way around that
> > though?
> > It seems to me that not NotImplemented sh
On Wed, Mar 11, 2020 at 09:42:15AM -, Steve Jorgensen wrote:
> I realize this is probably something that would be hard to change for
> compatibility reasons. Maybe someone can think of a way around that
> though?
>
> It seems to me that `not NotImplemented` should result in
> `NotImplement
Steve Jorgensen wrote:
> I realize this is probably something that would be hard to change for
> compatibility
> reasons. Maybe someone can think of a way around that though?
> It seems to me that not NotImplemented should result in
> NotImplemented and attempting to convert it to bool should rais
NotImplemented is not supposed to be used in any operation. It's just
a special value used in coercion since raising exceptions would be
too costly.
In your example you would need to check for this special value using
the "is" comparison.
See https://www.python.org/dev/peps/pep-0208/ and
https://
19 matches
Mail list logo