Makes perfect sense. If you’re checking if a collection is empty you don’t need to know its exact size. Getting the size can be very inefficient in collections like linked lists or trees, if you have to follow all nodes.
To check if it’s empty, all you need fo know if at least one item exists. If one does, there’s no point counting the rest.
People who don’t understand the difference will probably not understand the difference between passing a list and passing an literator/generator to any() .
Makes perfect sense. If you’re checking if a collection is empty you don’t need to know its exact size. Getting the size can be very inefficient in collections like linked lists or trees, if you have to follow all nodes. To check if it’s empty, all you need fo know if at least one item exists. If one does, there’s no point counting the rest.
People who don’t understand the difference will probably not understand the difference between passing a list and passing an literator/generator to
any()
.