Cursor

digraph InheritanceGraph { graph [bgcolor=transparent, color=lightsteelblue2, fontname=Arial, fontsize=10, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, splines=spline, style="dashed, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=10, height=0, penwidth=2, shape=box, style="filled, rounded", width=0]; edge [color=lightslategrey, penwidth=1]; subgraph cluster_builtins { graph [label=builtins]; node [color=1]; "builtins.object" [URL="https://docs.python.org/3.7/library/functions.html#object", label=object, target=_top]; } subgraph cluster_tsmakers { graph [label=tsmakers]; node [color=2]; "tsmakers.Cursor.Cursor" [URL="../api/tsmakers/Cursor.html#tsmakers.Cursor.Cursor", color=black, fontcolor=white, label=Cursor, target=_top]; } "builtins.object" -> "tsmakers.Cursor.Cursor"; }

class tsmakers.Cursor.Cursor(sequence=(1, 2, 3), index=None)[source]

A cursor.

>>> cursor = tsmakers.Cursor([1, 2, 3])
>>> next(cursor)
1
>>> next(cursor)
2
>>> next(cursor)
3
>>> next(cursor)
1
>>> next(cursor)
2
>>> cursor.backtrack()
2
>>> cursor.backtrack()
1
>>> cursor.backtrack()
3
>>> next(cursor)
3
>>> next(cursor)
1
>>> talea = abjadext.rmakers.Talea(
...     counts=(2, 1, 3, 2, 4, 1, 1),
...     denominator=16,
... )
>>> cursor = tsmakers.Cursor(talea)
>>> for _ in range(10):
...     next(cursor)
... 
Duration(1, 8)
Duration(1, 16)
Duration(3, 16)
Duration(1, 8)
Duration(1, 4)
Duration(1, 16)
Duration(1, 16)
Duration(1, 8)
Duration(1, 16)
Duration(3, 16)

Attributes Summary

__iter__

__next__

__repr__

Return repr(self).

__str__

Return str(self).

backtrack

index

next

sequence


Special methods

__iter__()[source]
__next__()[source]
overridden __repr__()[source]

Return repr(self).

overridden __str__()[source]

Return str(self).


Methods

backtrack()[source]
next()[source]

Read-only properties

index
sequence