Re: While stack:

2012-06-01 Thread MRAB
On 01/06/2012 18:59, David Shi wrote: Can any one clarify what "while stack:" mean? By convention, an empty container is considered false and a non-empty container true in Boolean tests. Therefore, assuming that "stack" is a container, it means "while the stack isn't empty". -- http://mail.pyt

Re: While stack:

2012-06-01 Thread Chris Angelico
On Sat, Jun 2, 2012 at 3:59 AM, David Shi wrote: > Can any one clarify what "while stack:" mean? It iterates as long as 'stack' has something that evaluates as true. My guess is that stack is a list, and the loop is removing elements from that list, so it'll keep going as long as there's anything

Re: While stack:

2012-06-01 Thread Corey Richardson
On Fri, 1 Jun 2012 18:59:57 +0100 (BST) David Shi wrote: > Can any one clarify what "while stack:" mean? > > Regards, > > David > Formal explanation: http://docs.python.org/reference/compound_stmts.html#while Informal introduction: http://learnpythonthehardway.org/book/ex33.html Simplistic