PAGE2GO2 HOME | INTERNET NEWS

LeighExchange - Free Advertising Network Stock Research at Internet Speed Need Money Easy and Quick?

Re: Python object overhead?

 List
Subject: Re: Python object overhead?
Poster: Gabriel Genellina
Date: Fri, 23 Mar 2007 19:11:23 -0300
Related Postings: 1 2 3 4 5 6 7
En Fri, 23 Mar 2007 18:27:25 -0300, Mark Nenadov 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

 

Page2Go2.com is not responsible for content of this message.