create boolean

Andre Engels andreengels at
Sat Mar 7 19:39:13 CET 2009

On Sat, Mar 7, 2009 at 6:03 AM, Grant Edwards <grante at> wrote:

> Putting in the second comparison in makes the code match the
> stated requirement.  Otherwise you have to start making
> assumptions about what n might be besides None or the empty
> list.

But the stated requirement already assumes that n is either None or a
list. The outcome is simply undefined when used on something that is
not None or a list. And it feels more in line with Python philosophy,
in particular with duck typing, to have 'list-like objects' (like sets
or tuples) behave like lists.

André Engels, andreengels at

More information about the Python-list mailing list