How does this code works:

2005-07-11 Thread vch
Here's an example from some book: def foo(n): s = [n] def bar(i): s[0] += i return s[0] return bar what I don't understand is how this example works, taking into account the LGB rule. I thought that s is not accessible from bar, but it is,

Re: file.readlines() question

2005-07-09 Thread vch
Erik Max Francis wrote: > ... modern versions of > Python allow iteration over a file, which will read it line by line: > > for line in aFile: > ... > Thanks! Just what I need. -- http://mail.python.org/mailman/listinfo/python-list

file.readlines() question

2005-07-09 Thread vch
Does a call to file.readlines() reads all lines at once in the memory? Are the any reasons, from the performance point of view, to prefer *while* loop with readline() to *for* loop with readlines()? -- http://mail.python.org/mailman/listinfo/python-list