algebraixlib.mathobjects package

This package contains the modules that define the classes that represent data.

The modules that contain classes that represent data are:

  • mathobject: Contains the abstract base class MathObject. It is the base class of all other data classes and can’t be instantiated.

    It also provides the utility functions raise_if_not_mathobject() and raise_if_not_mathobjects() that raise a TypeError if the argument is not an instance of MathObject (resp. is not a collection of such instances).

  • atom: Contains the class Atom. Instances of this class represent atoms; that is, values of non-math objects, like numbers, strings or any immutable Python value. All instances of Atom are members of set A (\(A\)), or conversely, set A is the set of all instances of Atom.

    It also provides the utility function auto_convert() that makes sure that its argument is always an instance of MathObject; if it isn’t, it converts it into an Atom.

  • couplet: Contains the class Couplet that represents a couplet.

  • set: Contains the class Set that represents a set.

  • multiset: Contains the class Multiset that represents a multiset.

  • utils: Provides various utilities for the other modules in this package.

In addition to the modules with classes that represent data, there is a private module _flags. It contains the class _flags.Flags that provides a mechanism to cache certain properties of MathObjects. It is used by property accessors like cached_relation and is not meant to be used by itself. (See also [PropCache].)

All module-level symbols (functions and classes, except _flags.Flags) are exposed at the package level, so if you import mathobjects (the package), these module-level symbols are imported. (Similarly, from mathobjects import ... can be used to import individual symbols from the package.)