New in version 2.0.
Abjad model of musical duration:
abjad> Duration(15, 16)
Duration(15, 16)
Durations inherit from built-in Fraction.
Note
Inherited from fractions.Fraction
Real numbers have no imaginary component.
Note
Inherited from numbers.Real
Note
Inherited from fractions.Fraction
Real numbers are their real component.
Note
Inherited from numbers.Real
Conjugate is a no-op for Reals.
Note
Inherited from numbers.Real
Closest Fraction to self with denominator at most max_denominator.
>>> Fraction('3.141592653589793').limit_denominator(10)
Fraction(22, 7)
>>> Fraction('3.141592653589793').limit_denominator(100)
Fraction(311, 99)
>>> Fraction(4321, 8765).limit_denominator(10000)
Fraction(4321, 8765)
Note
Inherited from fractions.Fraction
complex(self) == complex(float(self), 0)
Note
Inherited from numbers.Real
x.__delattr__(‘name’) <==> del x.name
Note
Inherited from __builtin__.object
float(self) = self.numerator / self.denominator
It’s important that this conversion use the integer’s “true” division rather than casting one side to float before dividing so that ratios of huge integers convert without overflowing.
Note
Inherited from numbers.Rational
a // b
Note
Inherited from fractions.Fraction
hash(self)
Tricky because values that are exactly representable as a float must have the same hash as that float.
Note
Inherited from fractions.Fraction
a != 0
Note
Inherited from fractions.Fraction
a // b
Note
Inherited from fractions.Fraction
x.__setattr__(‘name’, value) <==> x.name = value
Note
Inherited from __builtin__.object
str(self)
Note
Inherited from fractions.Fraction
trunc(a)
Note
Inherited from fractions.Fraction