Skip to content

Fields

ablina.field

A module for working with fields.

Field

Base class for fields.

Source code in ablina/field.py
class Field:
    """
    Base class for fields.
    """
    pass

Reals

Bases: Field, Reals

The field of real numbers.

Source code in ablina/field.py
class Reals(Field, _R):
    """
    The field of real numbers.
    """

    def __repr__(self) -> str:
        return "R"

    def __str__(self) -> str:
        return self.__repr__()

    def __contains__(self, other: Any) -> bool:
        try:
            return super().__contains__(other)
        except Exception:
            return False

Complexes

Bases: Field, Complexes

The field of complex numbers.

Source code in ablina/field.py
class Complexes(Field, _C):
    """
    The field of complex numbers.
    """

    def __repr__(self) -> str:
        return "C"

    def __str__(self) -> str:
        return self.__repr__()

    def __contains__(self, other: Any) -> bool:
        try:
            return super().__contains__(other)
        except Exception:
            return False

Rationals

Bases: Field, Rationals

The field of rational numbers.

Source code in ablina/field.py
class Rationals(Field, _Q):
    """
    The field of rational numbers.
    """

    def __repr__(self) -> str:
        return "Q"

    def __str__(self) -> str:
        return self.__repr__()

    def __contains__(self, other: Any) -> bool:
        try:
            return super().__contains__(other)
        except Exception:
            return False

R = Reals() module-attribute

Singleton instance representing the field of real numbers.

C = Complexes() module-attribute

Singleton instance representing the field of complex numbers.

Q = Rationals() module-attribute

Singleton instance representing the field of rational numbers.