Python object overhead?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri Mar 23 23:11:23 CET 2007


En Fri, 23 Mar 2007 18:27:25 -0300, Mark Nenadov  
<mark at freelance-developer.com> escribió:

> I'd suggest doing the following instead of that while loop:
>
> for line in open(sys.argv[1]).xreadlines():

Poor xreadlines method had a short life: it was born on Python 2.1 and got  
deprecated on 2.3 :(
A file is now its own line iterator:

f = open(...)
for line in f:
   ...

-- 
Gabriel Genellina




More information about the Python-list mailing list