[Python-Dev] bool(iter([])) changed between 2.3 and 2.4 (original) (raw)

Jim Jewett jimjjewett at gmail.com
Thu Sep 22 15:41:32 CEST 2005


Greg Ewing wrote:

But if the docs don't mention anything about true or false values for some particular type, one tends to assume that all values are true, as is the default for user-defined classes.

The tutorials and such stress that python doesn't typically care about a specific "True" or "False"; the normal distinction is between "empty" and "not empty".

0, None, (), [], {} all come out as false.

"Is there anything left?" is a pretty analogy for iterators, particularly since the examples tend to start with list or file iterators.

x = [] or iter([]) or "nope" does just what I expect.

If you want to change it back, so be it, but it will break code that way too; please at least make big notes in the documentation.

-jJ



More information about the Python-Dev mailing list