create boolean

Christian Heimes lists at
Fri Mar 6 14:28:05 CET 2009

Fencer schrieb:
> Hi, I need a boolean b to be true if the variable n is not None and not
> an empty list, otherwise b should be false.
> I ended up with:
> b = n is not None and not not n
> which seems to work but is that normally how you would do it?
> It can be assumed that n is always None or a list that might be empty

b = bool(n)


More information about the Python-list mailing list