Why is there no explicit emptyness check (for example `is Empty`) in Python

Viewed 2669

The Zen of Python says "Explicit is better than implicit". Yet the "pythonic" way to check for emptiness is using implicit booleaness:

if not some_sequence:
    some_sequence.fill_sequence()

This will be true if some_sequence is an empty sequence, but also if it is None or 0.

Compare with a theoretical explicit emptiness check:

if some_sequence is Empty:
    some_sequence.fill_sequence()

With some unfavorably chosen variable name the implicit booleaness to check for emptiness gets even more confusing:

if saved:
    mess_up()

Compare with:

if saved is not Empty:
    mess_up()

See also: "Python: What is the best way to check if a list is empty?". I find it ironic that the most voted answer claims that implicit is pythonic.

So is there a higher reason why there is no explicit emptiness check, like for example is Empty in Python?

5 Answers
Related