In article <[EMAIL PROTECTED]>,
Alex Martelli <[EMAIL PROTECTED]> wrote:
                        .
                        .
                        .
>My preference would be (with the original definition for
>words_of_the_file) to code
>
>   numwords = sum(1 for w in words_of_the_file(thefilepath))
                        .
                        .
                        .
There are times when 

    numwords = len(list(words_of_the_file(thefilepath))

will be advantageous.

For that matter, would it be an advantage for len() to operate
on iterables?  It could be faster and thriftier on memory than
either of the above, and my first impression is that it's 
sufficiently natural not to offend those of suspicious of
language bloat.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to