Ethan Furman wrote:
> On 8/24/21 3:03 PM, Tim Hoffmann via Python-ideas wrote:
> > **How do you check if a container is empty?**
> > IMHO the answer should not depend on the container.
> I think this is the fly in the ointment -- just about everything, from len() 
> to bool(), to add, to iter() /all/ depend 
> on the container -- even equality depends on the container.  `and`, `or`, and 
> `not` partially depend on the container 
> (via bool()).  Only `is` is truly independent.

Sorry, I think you got me wrong: The meaning and thus implementation depends on 
the type (e.g. each container defines its own __len__()). However the syntax 
for querying length that is still uniformly `len(container)`. Likewise I'd like 
to have a uniform syntax for emptiness, and not different syntax for different 
types (`if not container` / `if len(array) == 0` / `if dataframe.empty`).
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/LRK6HHQKBH2Y4USB7DAJNOUF5NE62ZYD/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to