algebraixlib.undef module

Class Undef (represents the concept of ‘undefined’) and associated constructs.

class algebraixlib.undef.Undef[source]

Bases: object

A singleton class that represents the concept of “undefined”. It can’t be treated as a value by the Data Algebra library and specifically it will never appear as the value of an Atom.

static __new__()[source]

Override __new__ to create a singleton class.

__str__()[source]

Pretty-print Undef.

__eq__(other)[source]

Prevent comparisons on Undef; raise a TypeError.

__ne__(other)[source]

Prevent comparisons on Undef; raise a TypeError.

__hash__ = None
class algebraixlib.undef.RaiseOnUndef[source]

Bases: object

Manage the level for make_or_raise_undef(). Implemented as static class.

static get_level()[source]

Return the current level for raising an UndefException.

The exception is raised if the ‘level’ argument of make_or_raise_undef() is less than or equal to the value returned here.

static set_level(temp_value)[source]

Set the level for raising an UndefException temporarily to ‘temp_value’.

static reset()[source]

Reset the level for raising an UndefException back to its initial value.

exception algebraixlib.undef.UndefException[source]

Bases: Exception

This exception is raised when the ‘level’ argument of make_or_raise_undef() is less than or equal to the RaiseOnUndef level.

algebraixlib.undef.make_or_raise_undef(level=1)[source]

Raise UndefException if level is less than or equal to the RaiseOnUndef level, otherwise return Undef().

Parameters:level – An integer >= 1. Default is 1.

Note

Use 1 (or no argument) for the cases that are most likely to be errors (like wrong argument types). Use higher numbers for cases that may return Undef() on purpose.