~ubuntu-branches/ubuntu/lucid/python2.6/lucid

« back to all changes in this revision

Viewing changes to Doc/library/itertools.rst

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-10-03 12:03:05 UTC
  • mto: (10.1.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 32.
  • Revision ID: james.westby@ubuntu.com-20091003120305-hij6yssh0figh590
Tags: upstream-2.6.3
ImportĀ upstreamĀ versionĀ 2.6.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
366
366
          # izip('ABCD', 'xy') --> Ax By
367
367
          iterables = map(iter, iterables)
368
368
          while iterables:
369
 
              yield yield tuple(map(next, iterables))
 
369
              yield tuple(map(next, iterables))
370
370
 
371
371
   .. versionchanged:: 2.4
372
372
      When no iterables are specified, returns a zero length iterator instead of
702
702
               pending -= 1
703
703
               nexts = cycle(islice(nexts, pending))
704
704
 
705
 
   def powerset(iterable):
706
 
       "powerset([1,2,3]) --> () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)"
707
 
       s = list(iterable)
708
 
       return chain.from_iterable(combinations(s, r) for r in range(len(s)+1))
709
 
 
710
705
   def compress(data, selectors):
711
706
       "compress('ABCDEF', [1,0,1,0,1,1]) --> A C E F"
712
707
       return (d for d, s in izip(data, selectors) if s)