Coding style
tac-tics
tactics40 at gmail.com
Mon Jul 17 20:42:19 EDT 2006
dwelch91 wrote:
> tac-tics wrote:
> >
> > I'd say the second one. Empty lists are not false. They are empty. Long
> > live dedicated boolean data types.
> >
> Uh, no, empty lists are False in a boolean context:
>
> http://docs.python.org/lib/truth.html
>
> -Don
Perhaps I should have specified it like this:
>>> empty_list = []
>>> empty_list is not False
True
I'm well aware that both of these snippets does the same thing. I'm
just spouting my opinion that lists and integers are not tests, and in
an ideal world (Java??? X-) if statements support only boolean types.
DISCLAIMER: I do not promote the use of Java.
More information about the Python-list
mailing list