need help on need help on generator...

Alex Martelli aleaxit at yahoo.com
Sat Jan 22 06:20:36 EST 2005


Craig Ringer <craig at postnewspapers.com.au> wrote:

> .>>> data = ''.join(x for x in infile)

Maybe ''.join(infile) is a better way to express this functionality?
Avoids 2.4 dependency and should be faster as well as more concise.


> Might it be worth providing a way to have file objects seek back to the
> current position of the iterator when read() etc are called? If not, I

It's certainly worth doing a patch and see what the python-dev crowd
thinks of it, I think; it might make it into 2.5.

> favour the suggestion in the referenced post - file should probably fail
> noisily, or at least emit a warning.

Under what conditions, exactly, would you want such an exception?


Alex



More information about the Python-list mailing list