Class: bool

Sk.builtin.bool(x) → {Sk.builtin.bool}

new bool(x) → {Sk.builtin.bool}

Constructor for Python bool. Also used for builtin bool() function.

Where possible, do not create a new instance but use the constants Sk.builtin.bool.true$ or Sk.builtin.bool.false$. These are defined in src/constant.js

Parameters:
Name Type Description
x Object | number | boolean

Value to evaluate as true or false

Source:
Returns:

Sk.builtin.bool.true$ if x is true, Sk.builtin.bool.false$ otherwise

Type
Sk.builtin.bool

Extends

Members

(static) false$ :Sk.builtin.bool

Python bool False constant.

Type:
Source:

(static) true$ :Sk.builtin.bool

Python bool True constant.

Type:
Source:

$r

Return the string representation of this instance.

Javascript function, returns Python object.

Inherited From:
Source:

__eq__

Python wrapper for __eq__ 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:

__le__

Python wrapper for __le__ method.

Inherited From:
Source:

__lt__

Python wrapper for __lt__ method.

Inherited From:
Source:

__ne__

Python wrapper for __ne__ method.

Inherited From:
Source:

__new__

Default implementation of new just calls the class constructor

Inherited From:
Source:

__repr__

Python wrapper for __repr__ method.

Inherited From:
Source:

__str__

Python wrapper for __str__ method.

Inherited From:
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

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.

Overrides:
Source:
Returns:

The hash value

Type
Sk.builtin.int_