450 Pound Library Program
Sion Arrowsmith
siona at chiark.greenend.org.uk
Wed Feb 8 09:49:48 EST 2006
mwt <michaeltaft at gmail.com> wrote:
> while len(self.stacks) == 0:
To (kind of) repeat myself, the idiomatic Python would be:
while not self.stacks:
An empty list is considered to be false, hence testing the list
itself is the same as testing len(l) > 0 .
As someone else has noticed, you're using len() an awful lot
when you don't need to.
--
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
___ | "Frankly I have no feelings towards penguins one way or the other"
\X/ | -- Arthur C. Clarke
her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
More information about the Python-list
mailing list