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])

as_integer_ratio()

bit_length()

conjugate()

Conjugate is a no-op for Reals.

from_bytes(bytes, byteorder, *args[, signed])

hex()

is_integer()

to_bytes(length, byteorder, *args[, signed])

Attributes

denominator

Integers have a denominator of 1.

imag

Real numbers have no imaginary component.

numerator

Integers are their own numerators.

real

Real numbers are their real component.

value