Package pygeodesy :: Module iters :: Class _BaseIter |
[frames] | no frames]

# Class _BaseIter

      object --+
               |
    named._Named --+
                   |
                  _BaseIter

Known Subclasses:
  - PointsIter

(INTERNAL) Iterator over items with loop-back and de-duplication.

See Also: Luciano Ramalho, "Fluent Python", page 418+, O'Reilly, 2016.

Instance Methods
__init__(self, items, loop=0, dedup=False, Error=None, name='') New iterator over an iterable of `items`. |
enumerate(self, closed=False, copies=False, dedup=False) Yield all items, each as a 2-tuple `(index, item)`. |
__getitem__(self, index) Get the item(s) at the given `index` or `slice`. |
__iter__(self) Make this iterator `iterable`. |
iterate(self, closed=False, copies=False, dedup=False) Yield all items, each as `item`. |
__len__(self) Get the number of items seen so far. |
next_(self, dedup=False) Return the next item. |
Inherited from `named._Named`: `__imatmul__`, `__matmul__`, `__repr__`, `__rmatmul__`, `__str__`, `attrs`, `classof`, `copy`, `dup`, `methodname`, `rename`, `toRepr`, `toStr`, `toStr2` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__subclasshook__`

Properties
| copies Get the saved copies, if any (`tuple` or `list`) and only once.
| dedup Get the de-duplication setting (`bool`).
| loop Get the `loop` setting (`int`), `0` for non-loop-back.
| looped In this `Iter`ator in loop-back? (`bool`).
| next Get the next item.
Inherited from `named._Named`: `classname`, `classnaming`, `iteration`, `name`, `named`, `named2`, `named3`, `named4` Inherited from `object`: `__class__`

Method Details

### __init__ (self, items, loop=0, dedup=False, Error=None, name='') (Constructor) |
New iterator over an iterable of `items`. Arguments: `items` - Iterable (any `type`, except composites). `loop` - Number of loop-back items, also initial enumerate and iterate index (non-negative `int`). `dedup` - Skip duplicate items (`bool`). `Error` - Error to raise (LenError). `name` - Optional name (`str`). Raises: `Error` - Invalid `items` or sufficient number of `items`. `TypeError` - Composite `items`. Overrides: object.__init__

### enumerate (self, closed=False, copies=False, dedup=False) |
Yield all items, each as a 2-tuple `(index, item)`. Arguments: `closed` - Look back to the first `point(s)`. `copies` - Make a copy of all `items` (`bool`). `dedup` - Set de-duplication in loop-back (`bool`).

### __getitem__ (self, index) (Indexing operator) |
Get the item(s) at the given `index` or `slice`. Raises: `IndexError` - Invalid `index`, beyond `loop`.

### iterate (self, closed=False, copies=False, dedup=False) |
Yield all items, each as `item`. Arguments: `closed` - Look back to the first `point(s)`. `copies` - Make a copy of all `items` (`bool`). `dedup` - Set de-duplication in loop-back (`bool`). Raises: `Error` - Using `closed=True` without `loop`-back.

### next_ (self, dedup=False) |
Return the next item. Arguments: `dedup` - Set de-duplication for loop-back (`bool`).

Property Details

### copies Get the saved copies, if any (`tuple` or `list`) and only once. Get method: copies(self) - Get the saved copies, if any (`tuple` or `list`) and only once. Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### dedup Get the de-duplication setting (`bool`). Get method: dedup(self) - Get the de-duplication setting (`bool`). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### loop Get the `loop` setting (`int`), `0` for non-loop-back. Get method: loop(self) - Get the `loop` setting (`int`), `0` for non-loop-back. Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### looped In this `Iter`ator in loop-back? (`bool`). Get method: looped(self) - In this `Iter`ator in loop-back? (`bool`). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### next Get the next item. Get method: next(self) - Get the next item. Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.