redvypr.config.configNumber¶
- class redvypr.config.configNumber(n=None)¶
Emulate numeric types based on “n” attribute, based on https://docs.python.org/3/reference/datamodel.html#basic-customization https://docs.python.org/3/reference/datamodel.html#emulating-numeric-types This is effectively a mutable container for a number, and can be subclassed to provide interesting properties that are related to the number. To use this class, subclass (if you like) or construct it directly, passing the numerical object you wish to make mutable to the initializer. The current immutable number is the ‘n’ attribute, and all the numeric type dunder methods just delegate to this current number.
Note this is a fork of https://github.com/markrages/python_mutable_number that includes a deepcopy functionality, i.e. returns the original data type if a copy.deepcopy() is called.
- __init__(n=None)¶
Methods
__init__([n])Conjugate is a no-op for Reals.
from_bytes(bytes, byteorder, *args[, signed])hex()to_bytes(length, byteorder, *args[, signed])Attributes
denominatorIntegers have a denominator of 1.
imagReal numbers have no imaginary component.
numeratorIntegers are their own numerators.
realReal numbers are their real component.
value