Numerical Typing

All objects mentioned here inherit the Number

Complex

class cake.Complex(a: Optional[cake.abc.IntegerType] = 0, b: Optional[cake.abc.IntegerType] = 0, raw: Optional[str] = None, check_value_attr: Optional[bool] = True, *args, **kwargs)

A class representing a complex number, subclass of Number

A complex is number which can be expressed in the form of a + bi, were a and b are integers. Learn more here

Parameters
  • a (IntegerType) – Any object which matches the IntegerType protocol. Fills the Defaults to 0

  • check_value_attr (bool) – See me </cake/api/index.html#cake.Number.value>

  • *args (Any) – See me </cake/api/index.html#cake.Number.value>

Float

class cake.Float(real: cake.abc.FloatType = 0, check_value_attr: bool = True, *args, **kwargs)

A class representing a whole number, subclass of Number

Parameters
  • number (FloatType) – Any object which matches the FloatType protocol. Defaults to 0

  • check_value_attr (bool) – See me </cake/api/index.html#cake.Number.value>

  • *args (Any) – See me </cake/api/index.html#cake.Number.value>

Integer

class cake.Integer(integer: Optional[bool] = 0, check_value_attr: Optional[bool] = True, *args, **kwargs)

A class representing a whole number, subclass of Number

Parameters
  • number (IntegerType) – Any object which matches the IntegerType protocol. Defaults to 0

  • check_value_attr (bool) – When a user preforms an arithmetic action it will check the other argument for the value attribute If found, it replaces the argument with that value, else returns the original argument

Irrational

class cake.Irrational(value: cake.abc.FloatType = 0, check_value_attr: bool = True, *args, **kwargs)

A class representing an irrational number, subclass of Number

If the value is not a float/real it returns a Number. If it is not irrational it returns a Real. Else it returns the Irrational class.

You should never feed this class with objects, but the raw value

Parameters
  • value (FloatType) – Any object which matches the FloatType protocol. Defaults to 0

  • check_value_attr (bool) – See Number

  • *args (Any) – See Number