any(), all() and empty iterable

Luis Alberto Zarrabeitia Gomez kyrie at uh.cu
Tue Apr 14 20:21:18 CEST 2009


Quoting John O'Hagan <research at johnohagan.com>:

> An exception, or at least a specific mention of the case of empty iterables
> in the docs (as Tim Chase suggested), would have baffled me less than my 
> program telling me that the same items were both ubiquitous and entirely 
> absent from a list of sets!

Well, they _were_ both ubiquitous and entirely absent from your list of sets:
both propositions are true. "Vacuous truth" doesn't mean that the answer is
incorrect, just that it is meaningless. The problem was not in the answer, but
in the question you asked.

> Of course, it's possible people out there depend on the present behaviour.

It's more than that. Python's following the rules here. Maybe it could be
documented better, for those without a background in logic/discrete mathematics,
but not changed.

-- 
Luis Zarrabeitia
Facultad de Matemática y Computación, UH
http://profesores.matcom.uh.cu/~kyrie

-- 
Participe en Universidad 2010, del 8 al 12 de febrero de 2010
La Habana, Cuba 
http://www.universidad2010.cu




More information about the Python-list mailing list