Computer Science Canada

Tricky Python question :)

Author:  wtd [ Fri Sep 09, 2005 11:38 pm ]
Post subject:  Tricky Python question :)

What's wrong with the following statement?

"In Python, methods are public by default."

Author:  wtd [ Sat Sep 10, 2005 1:34 am ]
Post subject: 

What's the difference between:

code:
for line in file('foo').readlines():
   ...


And:

code:
for line in file('foo'):
   ...

Author:  Hikaru79 [ Sat Sep 10, 2005 1:41 am ]
Post subject: 

IRC wrote:
<wtd> In that same thread, there's another question up. Smile
<Hikaru79> Oh, I know that one. I think.
<wtd> Nifty
<Hikaru79> Is it that 'readlines()' reads the whole file in at once and then splits it into iteratable lines, while the second one reads the file line by line?
<wtd> Indeed.
<Hikaru79> w00t =D


: