[Python-Dev] Python 2.3 release schedule

Raymond Hettinger python@rcn.com
Sun, 26 May 2002 01:19:15 -0400


> - Extended slice notation for all built-in sequences.  Wasn't Raymond
>   Hettinger working on this?

Yes!

> Anything else?

Perhaps an iterator tools module featuring goodies from SML and Haskell:

   import itertools
   ia = itertools.iter(open('readme.txt'))
   ia[4]                    # nth / index
   ia[0]                    # first
   ia[-1]                   # last
   ia[:10]                  # tail / drop
   ia[5:]                   # head / take
   ia[0,100,2]              # slicing
   ia.enumerate(countfrom=0)
   ia.filter(pred)          # takewhile
   ia.invfilter(pred)       # dropwhile
   ia.map(func)
   ia.starmap(func)         # [yield func(*args) for args in ia]
   ia.cycle()               # repeats the seqn infinitely (requires aux mem)
   ia.unzip()               # creates multiple iters from one
   ia.tabulate(func, countFrom=0)     # sml: f[0], f[1], ... = ia.map(func,
xrange(countFrom,sys.maxint))

   itertools.repeat(obj)           # while 1: yield obj
   itertools.zip(i1, i2, i3, ...)



Raymond Hettinger