New submission from Claudiu Saftoiu:

Right now, itertools.permutations and itertools.combinations and 
itertools.product objects don't have a `len`. 

    >>> len(itertools.combinations(range(10), 5))
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: object of type 'itertools.combinations' has no len()

I propose that a `len` be added to them, which computes (& caches) & returns 
the length. If the underlying iterator doesn't have a length, then they can 
raise a TypeError as they do now.

----------
messages: 271952
nosy: Claudiu Saftoiu
priority: normal
severity: normal
status: open
title: itertools.permutations/.combinations should have len
type: enhancement
versions: Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27678>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to