Class: numtype

Sk.builtin.numtype() → {undefined}

new numtype() → {undefined}

Abstract class for Python numeric types.

Source:
Returns:

Cannot instantiate a Sk.builtin.numtype object

Type
undefined

Extends

Members

$r

Return the string representation of this instance.

Javascript function, returns Python object.

Inherited From:
Source:

__abs__

Python wrapper of __abs__ method.

Source:

__add__

Python wrapper of __add__ method.

Source:

__coerce__

Python wrapper of __coerce__ method.

Source:

__div__

Python wrapper of __div__ method.

Source:

__divmod__

Python wrapper of __divmod__ method.

Source:

__eq__

Python wrapper for __eq__ method.

Inherited From:
Source:

__float__

Python wrapper of __float__ method.

Source:

__floordiv__

Python wrapper of __floordiv__ method.

Source:

__ge__

Python wrapper for __ge__ method.

Inherited From:
Source:

__gt__

Python wrapper for __gt__ method.

Inherited From:
Source:

__hash__

Python wrapper for __hash__ method.

Inherited From:
Source:

__int__

Python wrapper of __int__ method.

Source:

__le__

Python wrapper for __le__ method.

Inherited From:
Source:

__long__

Python wrapper of __long__ method.

Source:

__lt__

Python wrapper for __lt__ method.

Inherited From:
Source:

__mod__

Python wrapper of __mod__ method.

Source:

__mul__

Python wrapper of __mul__ method.

Source:

__ne__

Python wrapper for __ne__ method.

Inherited From:
Source:

__neg__

Python wrapper of __neg__ method.

Source:

__new__

Default implementation of new just calls the class constructor

Inherited From:
Source:

__pos__

Python wrapper of __pos__ method.

Source:

__pow__

Python wrapper of __pow__ method.

Source:

__radd__

Python wrapper of __radd__ method.

Source:

__rdiv__

Python wrapper of __rdiv__ method.

Source:

__rdivmod__

Python wrapper of __rdivmod__ method.

Source:

__repr__

Python wrapper for __repr__ method.

Inherited From:
Source:

__rfloordiv__

Python wrapper of __rfloordiv__ method.

Source:

__rmod__

Python wrapper of __rmod__ method.

Source:

__rmul__

Python wrapper of __rmul__ method.

Source:

__rpow__

Python wrapper of __rpow__ method.

Source:

__rsub__

Python wrapper of __rsub__ method.

Source:

__str__

Python wrapper for __str__ method.

Inherited From:
Source:

__sub__

Python wrapper of __sub__ method.

Source:

ob$type :Sk.builtin.type|Object

The type object of this class.

Type:
  • Sk.builtin.type | Object
Inherited From:
Source:

tp$name :string

The name of this class.

Type:
  • string
Inherited From:
Source:

Methods

GenericGetAttr(pyName, canSuspendopt) → {undefined}

Get an attribute

Parameters:
Name Type Attributes Description
pyName Object

Python string name of the attribute

canSuspend boolean <optional>

Can we return a suspension?

Inherited From:
Source:
Returns:
Type
undefined

GenericSetAttr(pyName, value, canSuspendopt) → {undefined}

Parameters:
Name Type Attributes Description
pyName Object
value Object
canSuspend boolean <optional>
Inherited From:
Source:
Returns:
Type
undefined

nb$abs() → {Sk.builtin.numtype|Sk.builtin.NotImplemented}

Compute the absolute value of this instance and return.

Javascript function, returns Python object.

Source:
Returns:

The absolute value

Type
Sk.builtin.numtype | Sk.builtin.NotImplemented

nb$add(othernon-null) → {Sk.builtin.numtype|Sk.builtin.NotImplemented}

Add a Python object to this instance and return the result (i.e. this + other).

Returns NotImplemented if addition between this type and other type is unsupported.

Javscript function, returns Python object.

Parameters:
Name Type Description
other Sk.builtin.object

The Python object to add.

Source:
Returns:

The result of the addition.

Type
Sk.builtin.numtype | Sk.builtin.NotImplemented

nb$divide(othernon-null) → {Sk.builtin.numtype|Sk.builtin.NotImplemented}

Divide this instance by a Python object and return the result (i.e this / other).

Returns NotImplemented if division between this type and other type is unsupported.

Javscript function, returns Python object.

Parameters:
Name Type Description
other Sk.builtin.object

The divisor, which must be a Python object.

Source:
Returns:

The result of the division

Type
Sk.builtin.numtype | Sk.builtin.NotImplemented

nb$divmod(othernon-null) → {Sk.builtin.tuple|Sk.builtin.NotImplemented}

Compute the quotient and the remainder of this instance and a given Python object and return the result.

Returns NotImplemented if division or modulo operations between this type and other type are unsupported.

Javscript function, returns Python object.

Parameters:
Name Type Description
other Sk.builtin.object

The divisor, which must be a Python object.

Source:
Returns:

The result of the operation. If both operations are supported, a Python tuple containing (quotient, remainder) in that order.

Type
Sk.builtin.tuple | Sk.builtin.NotImplemented

nb$floor_divide(othernon-null) → {Sk.builtin.numtype|Sk.builtin.NotImplemented}

Floor divide this instance by a Python object and return the result (i.e. this // other).

Returns NotImplemented if floor division between this type and other type is unsupported.

Javscript function, returns Python object.

Parameters:
Name Type Description
other Sk.builtin.object

The divisor, which must be a Python object.

Source:
Returns:

The result of the floor division

Type
Sk.builtin.numtype | Sk.builtin.NotImplemented

nb$isnegative() → {boolean|Sk.builtin.NotImplemented}

Determine if this instance is negative.

Javscript function, returns Javascript object or Sk.builtin.NotImplemented.

Source:
Returns:

true if this instance is negative, false otherwise

Type
boolean | Sk.builtin.NotImplemented

nb$ispositive() → {boolean|Sk.builtin.NotImplemented}

Determine if this instance is positive.

Javscript function, returns Javascript object or Sk.builtin.NotImplemented.

Source:
Returns:

true if this instance is positive, false otherwise

Type
boolean | Sk.builtin.NotImplemented

nb$multiply(othernon-null) → {Sk.builtin.numtype|Sk.builtin.NotImplemented}

Multiply this instance by a Python object and return the result (i.e. this * other).

Returns NotImplemented if multiplication between this type and other type is unsupported.

Javscript function, returns Python object.

Parameters:
Name Type Description
other Sk.builtin.object

The multiplier, which must be a Python object.

Source:
Returns:

The result of the multiplication

Type
Sk.builtin.numtype | Sk.builtin.NotImplemented

nb$negative() → {Sk.builtin.numtype|Sk.builtin.NotImplemented}

Compute the unary negative of this instance (i.e. -this).

Javscript function, returns Python object.

Source:
Returns:

A copy of this instance with the value negated

Type
Sk.builtin.numtype | Sk.builtin.NotImplemented

nb$nonzero() → {boolean|Sk.builtin.NotImplemented}

Determine if this instance is nonzero.

Javscript function, returns Javascript object or Sk.builtin.NotImplemented.

Source:
Returns:

true if this instance is not equal to zero, false otherwise

Type
boolean | Sk.builtin.NotImplemented

nb$positive() → {Sk.builtin.numtype|Sk.builtin.NotImplemented}

Compute the unary positive of this instance (i.e. +this).

Javscript function, returns Python object.

Source:
Returns:

A copy of this instance with the value unchanged

Type
Sk.builtin.numtype | Sk.builtin.NotImplemented

nb$power(othernon-null, modopt, non-null) → {Sk.builtin.numtype|Sk.builtin.NotImplemented}

Raise this instance by a Python object, optionally modulo the exponent, and return the final result.

If mod is undefined, return this ** other. Else, return (this ** other) % mod.

Returns NotImplemented if exponentiation or modulation between this type and other type is unsupported.

Javscript function, returns Python object.

Parameters:
Name Type Attributes Description
other Sk.builtin.object

The exponent, which must be a Python object.

mod Sk.builtin.object <optional>

The optional divisor, which must be a Python object if defined.

Source:
Returns:

The result of the exponentiation.

Type
Sk.builtin.numtype | Sk.builtin.NotImplemented

nb$remainder(othernon-null) → {Sk.builtin.numtype|Sk.builtin.NotImplemented}

Modulo this instance by a Python object and return the result (i.e. this % other).

Returns NotImplemented if modulation between this type and other type is unsupported.

Javscript function, returns Python object.

Parameters:
Name Type Description
other Sk.builtin.object

The divisor, which must be a Python object.

Source:
Returns:

The result of the modulation

Type
Sk.builtin.numtype | Sk.builtin.NotImplemented

nb$subtract(othernon-null) → {Sk.builtin.numtype|Sk.builtin.NotImplemented}

Subtract a Python object from this instance and return the result (i.e. this - other).

Returns NotImplemented if subtraction between this type and other type is unsupported.

Javscript function, returns Python object.

Parameters:
Name Type Description
other Sk.builtin.object

The Python object to subtract.

Source:
Returns:

The result of the subtraction.

Type
Sk.builtin.numtype | Sk.builtin.NotImplemented

ob$eq(other) → {Sk.builtin.bool|Sk.builtin.NotImplemented}

Perform equality check between this instance and a Python object (i.e. this == other).

Implements __eq__ dunder method.

Javascript function, returns Python object.

Parameters:
Name Type Description
other Object

The Python object to check for equality.

Inherited From:
Source:
Returns:

true if equal, false otherwise

Type
Sk.builtin.bool | Sk.builtin.NotImplemented

ob$ge(other) → {Sk.builtin.bool|Sk.builtin.NotImplemented}

Determine if this instance is greater than or equal to a Python object (i.e. this >= other).

Implements __ge__ dunder method.

Javascript function, returns Python object.

Parameters:
Name Type Description
other Object

The Python object to compare.

Inherited From:
Source:
Returns:

true if this >= other, false otherwise

Type
Sk.builtin.bool | Sk.builtin.NotImplemented

ob$gt(other) → {Sk.builtin.bool|Sk.builtin.NotImplemented}

Determine if this instance is greater than a Python object (i.e. this > other).

Implements __gt__ dunder method.

Javascript function, returns Python object.

Parameters:
Name Type Description
other Object

The Python object to compare.

Inherited From:
Source:
Returns:

true if this > other, false otherwise

Type
Sk.builtin.bool | Sk.builtin.NotImplemented

ob$le(other) → {Sk.builtin.bool|Sk.builtin.NotImplemented}

Determine if this instance is less than or equal to a Python object (i.e. this <= other).

Implements __le__ dunder method.

Javascript function, returns Python object.

Parameters:
Name Type Description
other Object

The Python object to compare.

Inherited From:
Source:
Returns:

true if this <= other, false otherwise

Type
Sk.builtin.bool | Sk.builtin.NotImplemented

ob$lt(other) → {Sk.builtin.bool|Sk.builtin.NotImplemented}

Determine if this instance is less than a Python object (i.e. this < other).

Implements __lt__ dunder method.

Javascript function, returns Python object.

Parameters:
Name Type Description
other Object

The Python object to compare.

Inherited From:
Source:
Returns:

true if this < other, false otherwise

Type
Sk.builtin.bool | Sk.builtin.NotImplemented

ob$ne(other) → {Sk.builtin.bool|Sk.builtin.NotImplemented}

Perform non-equality check between this instance and a Python object (i.e. this != other).

Implements __ne__ dunder method.

Javascript function, returns Python object.

Parameters:
Name Type Description
other Object

The Python object to check for non-equality.

Inherited From:
Source:
Returns:

true if not equal, false otherwise

Type
Sk.builtin.bool | Sk.builtin.NotImplemented

tp$hash() → {Sk.builtin.int_}

Return the hash value of this instance.

Javascript function, returns Python object.

Inherited From:
Source:
Returns:

The hash value

Type
Sk.builtin.int_