On Thu, 12 Mar 2020 at 17:09, Christopher Barker <[email protected]> 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 sequence is empty, maybe if len(sequence) 
> == 0: is really a more clear test.

But it's against PEP 8.

> And by the way, numpy arrays are not Sequences as far as collections.abc is 
> concerned

But it quacks like a sequence.

IMHO numpy arrays should result as they implements
collections.abc.Sequence, even if it's really not true. Like dict:

>>> help(dict)
Help on class dict in module builtins:

class dict(object)
[...]
>>> issubclass(dict, MutableMapping)
True
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/OUADLYPYJD2YGQH55BNNZFIYQKHNTGPK/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to