Code Feedback

Sion Arrowsmith siona at chiark.greenend.org.uk
Tue Feb 7 08:15:18 EST 2006


mwt <michaeltaft at gmail.com> wrote:
>1) Is this good Python code? What should be changed to make it more
>Pythonesque?

>        while not len(self.stacks) > 0:

        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 .

-- 
\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