[Python-Dev] itertools module
Skip Montanaro
skip@pobox.com
Mon, 27 Jan 2003 09:36:49 -0600
Raymond> If you see a typo or clear error, feel free to edit the files
Raymond> directly. If you don't feel like reading the C code, the docs
Raymond> list all known issues and include pure python equivalent code
Raymond> for each function. Let me know if I omitted your favorite
Raymond> function (tabulate, partition, etc).
(Note, I've never used Haskell or SML, so have no direct experience with any
of these iterators.)
I fixed a couple typos, but have a few (more subjective) comments:
* islice() - The description seems a bit confusing to me - perhaps a
simple example would be useful.
* takewhile()/dropwhile() - I assume these only return a prefix of their
iterable arguments. Dropwhile()'s help suggests that, but
takewhile()'s description is more vague about the notion.
* imap() - It's not clear to me why it differs from map() other than the
fact that it's an iterator. Can you motivate why it stops when the
shortest iterable is exhausted and doesn't accept Non for its func
arg?
* loopzip() - It's not clear why its next() method should return a list
instead of a tuple (again, a seemingly needless distiction with its
builtin counterpart, zip()).
* starmap() - How does it differ from imap() and map()?
* times() - Why not declare times to take an optional argument to be
returned? (In general, it seems like count(), repeat() and times()
overlap heavily. Examples of their usage might be helpful in
understanding when to use them, or at least when they are commonly
used in their Haskell/SML roots environments.)
Skip