ZeroDuration

ZeroDuration()

A Duration of zero length (instantaneous), belonging to every system.

It is the additive identity: adding it to any Duration gives that Duration back, and it is its own negation.

>>> from openmusickit.systems.wsmn.temporal.symbols import quarter
>>> ZeroDuration() + quarter, quarter + ZeroDuration()
(MetricalDuration(1, 4), MetricalDuration(1, 4))
>>> quarter - quarter
ZeroDuration()
>>> ZeroDuration().rational_length, -ZeroDuration()
(Fraction(0, 1), ZeroDuration())

Attributes

Name Description
__slots__
temporal_system
rational_length

Methods

Name Description
__eq__
__lt__ Shorter than other, by rational length, within compatible systems.
__hash__
__sub__ self + (-other): the difference of two durations, in whatever notation it takes.
scale Nothing scaled is still nothing.
__add__ Zero plus any Duration is that Duration, of any system.
__radd__ Any Duration plus zero is that Duration, even one that does not know
__neg__
__repr__

__eq__

__eq__(other)

__lt__

__lt__(other)

Shorter than other, by rational length, within compatible systems.

>>> from openmusickit.systems.wsmn.temporal.symbols import quarter, dotted_quarter
>>> quarter < dotted_quarter, dotted_quarter < quarter
(True, False)

__hash__

__hash__()

__sub__

__sub__(other)

self + (-other): the difference of two durations, in whatever notation it takes.

>>> from openmusickit.systems.wsmn.temporal.symbols import half, quarter
>>> half - quarter, quarter - half
(MetricalDuration(1, 4), MetricalDuration(-1, 4))

scale

scale(scalar: int | Fraction)

Nothing scaled is still nothing.

>>> ZeroDuration().scale(3)
ZeroDuration()

__add__

__add__(other: Duration)

Zero plus any Duration is that Duration, of any system.

>>> from openmusickit.values.time.clock_time import ClockDuration
>>> ZeroDuration() + ClockDuration(5)
ClockDuration(microseconds=5)

__radd__

__radd__(other)

Any Duration plus zero is that Duration, even one that does not know about ZeroDuration (ClockDuration); and sum may start from 0.

>>> from openmusickit.values.time.clock_time import ClockDuration
>>> ClockDuration(5) + ZeroDuration()
ClockDuration(microseconds=5)
>>> sum([ZeroDuration(), ZeroDuration()])
ZeroDuration()

__neg__

__neg__()

__repr__

__repr__()