Re: temporary scope change

2006-04-18 Thread Edward Elliott
Michael Spencer wrote: > Just replace: > for y in list2: > with: > if True: Of course. I knew it would be blindingly obvious. Sometimes you just can't shake the blinders off though. Thanks. > Note that neither the `if` nor the `for` statement actually creates a > new scope. Good cat

Re: temporary scope change

2006-04-18 Thread Michael Spencer
Edward Elliott wrote: ... > > for x in list1: > i += 1 > # for y in list2: > print x * i > > and have the print line execute as part of the for x block. In other > words, I want the block with print to be in the scope of the for x loop. > But instead it raises a SyntaxError bec

temporary scope change

2006-04-18 Thread Edward Elliott
The only time I miss block delimiters in Python is when I want to temporarily change the scope of a block. Suppose I have this code: for x in list1: i += 1 for y in list2: print x * i Ignore the semantics for the moment (yes the code is suboptimal). Say I need to disable th