Is Python Lazy?

Stefan Behnel stefan_ml at behnel.de
Sun May 6 02:10:27 EDT 2012


Dan Stromberg, 06.05.2012 07:40:
> you probably won't be able to write a sort routine, and
> use it as a "first 100 lowest values" routine for free.  But you could
> construct something that does almost the same thing lazily using a
> generator - not for free.

OTOH, if you really wanted to do this particular thing, I'd just use heapq.

Stefan




More information about the Python-list mailing list