Re: Coding style
- From: "tac-tics" <tactics40@xxxxxxxxx>
- Date: 17 Jul 2006 17:42:19 -0700
dwelch91 wrote:
tac-tics wrote:
Uh, no, empty lists are False in a boolean context:
I'd say the second one. Empty lists are not false. They are empty. Long
live dedicated boolean data types.
http://docs.python.org/lib/truth.html
-Don
Perhaps I should have specified it like this:
Trueempty_list = []
empty_list is not False
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.
.
- Follow-Ups:
- Re: Coding style
- From: Erik Max Francis
- Re: Coding style
- References:
- Coding style
- From: PTY
- Re: Coding style
- From: Simon Brunning
- Re: Coding style
- From: tac-tics
- Re: Coding style
- From: dwelch91
- Coding style
- Prev by Date: embedding python in a plugin
- Next by Date: Piping external commands
- Previous by thread: Re: Coding style
- Next by thread: Re: Coding style
- Index(es):
Relevant Pages
|