OpenQuizz
Une application de gestion des contenus pédagogiques
countable Class Reference

Public Member Functions

def __init__ (self, iterable)
 
def __iter__ (self)
 
def __next__ (self)
 

Data Fields

 items_seen
 

Detailed Description

Wrap *iterable* and keep a count of how many items have been consumed.

The ``items_seen`` attribute starts at ``0`` and increments as the iterable
is consumed:

    >>> iterable = map(str, range(10))
    >>> it = countable(iterable)
    >>> it.items_seen
    0
    >>> next(it), next(it)
    ('0', '1')
    >>> list(it)
    ['2', '3', '4', '5', '6', '7', '8', '9']
    >>> it.items_seen
    10

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  iterable 
)

Member Function Documentation

◆ __iter__()

def __iter__ (   self)

◆ __next__()

def __next__ (   self)

Field Documentation

◆ items_seen

items_seen

The documentation for this class was generated from the following file: