new float_(xnon-null) → {Sk.builtin.float_}
Constructor for Python float. Also used for builtin float().
Parameters:
Name | Type | Description |
---|---|---|
x |
Object | number | string | Object or number to convert to Python float. |
Returns:
Python float
- Type
- Sk.builtin.float_
Extends
Members
$r
Return the string representation of this instance.
Javascript function, returns Python object.
- Inherited From:
- Source:
__abs__
Python wrapper of __abs__
method.
- Inherited From:
- Source:
__add__
Python wrapper of __add__
method.
- Inherited From:
- Source:
__coerce__
Python wrapper of __coerce__
method.
- Inherited From:
- Source:
__div__
Python wrapper of __div__
method.
- Inherited From:
- Source:
__divmod__
Python wrapper of __divmod__
method.
- Inherited From:
- Source:
__eq__
Python wrapper for __eq__
method.
- Inherited From:
- Source:
__float__
Python wrapper of __float__
method.
- Inherited From:
- Source:
__floordiv__
Python wrapper of __floordiv__
method.
- Inherited From:
- 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.
- Inherited From:
- Source:
__le__
Python wrapper for __le__
method.
- Inherited From:
- Source:
__long__
Python wrapper of __long__
method.
- Inherited From:
- Source:
__lt__
Python wrapper for __lt__
method.
- Inherited From:
- Source:
__mod__
Python wrapper of __mod__
method.
- Inherited From:
- Source:
__mul__
Python wrapper of __mul__
method.
- Inherited From:
- Source:
__ne__
Python wrapper for __ne__
method.
- Inherited From:
- Source:
__neg__
Python wrapper of __neg__
method.
- Inherited From:
- Source:
__new__
Default implementation of new just calls the class constructor
- Inherited From:
- Source:
__pos__
Python wrapper of __pos__
method.
- Inherited From:
- Source:
__pow__
Python wrapper of __pow__
method.
- Inherited From:
- Source:
__radd__
Python wrapper of __radd__
method.
- Inherited From:
- Source:
__rdiv__
Python wrapper of __rdiv__
method.
- Inherited From:
- Source:
__rdivmod__
Python wrapper of __rdivmod__
method.
- Inherited From:
- Source:
__repr__
Python wrapper for __repr__
method.
- Inherited From:
- Source:
__rfloordiv__
Python wrapper of __rfloordiv__
method.
- Inherited From:
- Source:
__rmod__
Python wrapper of __rmod__
method.
- Inherited From:
- Source:
__rmul__
Python wrapper of __rmul__
method.
- Inherited From:
- Source:
__rpow__
Python wrapper of __rpow__
method.
- Inherited From:
- Source:
__rsub__
Python wrapper of __rsub__
method.
- Inherited From:
- Source:
__str__
Python wrapper for __str__
method.
- Inherited From:
- Source:
__sub__
Python wrapper of __sub__
method.
- Inherited From:
- Source:
nb$inplace_add
nb$inplace_divide
nb$inplace_floor_divide
nb$inplace_multiply
nb$inplace_power
nb$inplace_remainder
nb$inplace_subtract
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
(static) PyFloat_Check(op) → {boolean}
Checks for float subtypes, though skulpt does not allow to extend them for now.
Javascript function, returns Javascript object.
Parameters:
Name | Type | Description |
---|---|---|
op |
Object | The object to check as subtype. |
Returns:
true if op is a subtype of Sk.builtin.float_, false otherwise
- Type
- boolean
(static) PyFloat_Check_Exact(op) → {boolean}
Checks if ob is a Python float.
This method is just a wrapper, but uses the correct cpython API name.
Javascript function, returns Javascript object.
Parameters:
Name | Type | Description |
---|---|---|
op |
Object | The object to check. |
Returns:
true if op is an instance of Sk.builtin.float_, false otherwise
- Type
- boolean
"$r"()
clone() → {Sk.builtin.float_}
Returns a copy of this instance.
Javascript function, returns Python object.
Returns:
The copy
- Type
- Sk.builtin.float_
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.
- Overrides:
- Source:
Returns:
The absolute value
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. |
- Overrides:
- Source:
Returns:
The result of the addition.
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. |
- Overrides:
- Source:
Returns:
The result of the division
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. |
- Overrides:
- 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. |
- Overrides:
- Source:
Returns:
The result of the floor division
nb$isnegative() → {boolean|Sk.builtin.NotImplemented}
Determine if this instance is negative.
Javscript function, returns Javascript object or Sk.builtin.NotImplemented.
- Overrides:
- 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.
- Overrides:
- 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. |
- Overrides:
- Source:
Returns:
The result of the multiplication
nb$negative() → {Sk.builtin.numtype|Sk.builtin.NotImplemented}
Compute the unary negative of this instance (i.e. -this).
Javscript function, returns Python object.
- Overrides:
- Source:
Returns:
A copy of this instance with the value negated
nb$nonzero() → {boolean|Sk.builtin.NotImplemented}
Determine if this instance is nonzero.
Javscript function, returns Javascript object or Sk.builtin.NotImplemented.
- Overrides:
- 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.
- Overrides:
- Source:
Returns:
A copy of this instance with the value unchanged
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. |
- Overrides:
- Source:
Returns:
The result of the exponentiation.
nb$reflected_add()
nb$reflected_divide()
nb$reflected_divmod()
nb$reflected_floor_divide()
nb$reflected_multiply()
nb$reflected_power()
nb$reflected_remainder()
nb$reflected_subtract()
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. |
- Overrides:
- Source:
Returns:
The result of the modulation
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. |
- Overrides:
- Source:
Returns:
The result of the subtraction.
numberCompare() → {number|Sk.builtin.NotImplemented}
Compare this instance's value to another Python object's value.
Returns NotImplemented if comparison between float and other type is unsupported.
Javscript function, returns Javascript object or Sk.builtin.NotImplemented.
Returns:
negative if this < other, zero if this == other, positive if this > other
- Type
- number | 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. |
- Overrides:
- Source:
Returns:
true if equal, false otherwise
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. |
- Overrides:
- Source:
Returns:
true if this >= other, false otherwise
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. |
- Overrides:
- Source:
Returns:
true if this > other, false otherwise
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. |
- Overrides:
- Source:
Returns:
true if this <= other, false otherwise
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. |
- Overrides:
- Source:
Returns:
true if this < other, false otherwise
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. |
- Overrides:
- Source:
Returns:
true if not equal, false otherwise
round$(self, ndigits) → {Sk.builtin.float_|Sk.builtin.int_}
Round this instance to a given number of digits, or zero if omitted.
Implements __round__
dunder method.
Javascript function, returns Python object.
Parameters:
Name | Type | Description |
---|---|---|
self |
Sk.builtin.int_ | This instance. |
ndigits |
Object | number | The number of digits after the decimal point to which to round. |
Returns:
The rounded float.
- Type
- Sk.builtin.float_ | Sk.builtin.int_
str$(base, sign) → {string}
Convert this instance's value to a Javascript string.
Javascript function, returns Javascript object.
Parameters:
Name | Type | Description |
---|---|---|
base |
number | The base of the value. |
sign |
boolean | true if the value should be signed, false otherwise. |
Returns:
The Javascript string representation of this instance.
- Type
- string
toFixed(x) → {string}
Returns this instance's value as a string formatted using fixed-point notation.
Javascript function, returns Javascript object.
Parameters:
Name | Type | Description |
---|---|---|
x |
Object | number | The numer of digits to appear after the decimal point. |
Returns:
The string representation of this instance's value.
- Type
- string
tp$hash() → {Sk.builtin.int_}
Return the hash value of this instance.
Javascript function, returns Python object.
- Overrides:
- Source:
Returns:
The hash value
- Type
- Sk.builtin.int_
tp$index() → {number}
Return this instance's Javascript value.
Javascript function, returns Javascript object.
Returns:
This instance's value.
- Type
- number
tp$str() → {Sk.builtin.str}
Return the string representation of this instance.
Javascript function, returns Python object.
Returns:
The Python string representation of this instance.
- Type
- Sk.builtin.str