(self, id_generator=None, initial=None)
Creates a new unique ID generator. `id_generator` specifies how do we
        assign new IDs to elements that do not have an ID yet. If it is `None`,
        elements will be assigned integer identifiers starting from 0. If it is
        an integer, elements will be assigned identifiers starting from the given
        integer. If it is an iterator or generator, its `next` method will be
        called every time a new ID is needed.
Creates a new unique ID generator. `id_generator` specifies how do we
        assign new IDs to elements that do not have an ID yet. If it is `None`,
        elements will be assigned integer identifiers starting from 0. If it is
        an integer, elements will be assigned identifiers starting from the given
        integer. If it is an iterator or generator, its `next` method will be
        called every time a new ID is needed.
Creates a new unique ID generator . id_generator specifies how do we assign new IDs to elements that do not have an ID yet . If it is None elements will be assigned integer identifiers starting from 0 . If it is an integer elements will be assigned identifiers starting from the given integer . If it is an iterator or generator its next method will be called every time a new ID is needed .
def __init__(self, id_generator=None, initial=None):
        """Creates a new unique ID generator. `id_generator` specifies how do we
        assign new IDs to elements that do not have an ID yet. If it is `None`,
        elements will be assigned integer identifiers starting from 0. If it is
        an integer, elements will be assigned identifiers starting from the given
        integer. If it is an iterator or generator, its `next` method will be
        called every time a new ID is needed."""
        if id_generator is None:
            id_generator = 0
        if isinstance(id_generator, int):
            import itertools

            self._generator = itertools.count(id_generator)
        else:
            self._generator = id_generator
        self._ids = {}
        if initial:
            for value in initial:
                self.add(value)
def __init__ ( self , id_generator = None , initial = None ) : if id_generator is None : id_generator = 0 if isinstance ( id_generator , int ) : import itertools self . _generator = itertools . count ( id_generator ) else : self . _generator = id_generator self . _ids = { } if initial : for value in initial : self . add ( value )