[Python-ideas] Intermediate Summary: Fast sum() for non-numbers

David Mertz mertz at gnosis.cx
Tue Jul 16 06:53:06 CEST 2013


On Mon, Jul 15, 2013 at 8:21 PM, Sergey <sergemp at mail.ru> wrote:

> Do you think that people often know *args notation or add infinite lists?
> ;)
>

I think people now know *args notation, yes (and yes, I make typos
notwithstanding being a professional writer).

As for infinite lists, I actually had in mind a fairly specific and
ordinary example.  I can imagine that one has one iterator the yields
files, which themselves iterate over lines within files.  Maybe not
*infinite* quite, but one might have a lot of files (even a lot matching
some spec) on a slow network drive, and each of those files might have a
lot of lines.  One plausible thing to do is keep searching until we find
"the right line" ... but we don't want to actually open millions of files
if we don't need to.  E.g.:

  for line in chain.from_iterable(lines_in_many_files):
      got_it = check_the(line)
      if got_it:
          break


-- 
Keeping medicines from the bloodstreams of the sick; food
from the bellies of the hungry; books from the hands of the
uneducated; technology from the underdeveloped; and putting
advocates of freedom in prisons.  Intellectual property is
to the 21st century what the slave trade was to the 16th.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130715/50e5416e/attachment.html>


More information about the Python-ideas mailing list