ViewPop

class qugradlab.pulses.invertible_functions.packaging.ViewPop(iterator: Iterable)[source]

Bases: object

A class that allows for a view of an iterable to be popped.

Example

>>> x = [1, 2, 3, 4, 5, 6]
>>> v = ViewPop(x)
>>> v(2)
[1, 2]
>>> v(2)
[3, 4]
>>> v(1)
[5]
>>> v(2)
[6]

Attributes

iterator

The iterator to be viewed

index

The current index of the iterator

Methods

__init__

Initialises the view of the iterator.

__init__(iterator: Iterable)[source]

Initialises the view of the iterator.

Parameters:

iterator (Iterable) – The iterator to be viewed

index: int

The current index of the iterator

iterator: Iterable

The iterator to be viewed