builtins

Internal module containing built-in functions and classes.

Classes and functions from the __builtins__ module are generally available from all global namespaces. Built-in names can still be shadowed by module-level globals and function-level locals, so none the names in this module are reserved. When a built-in name has been shadowed, the original can be referenced directly as __builtins__.name instead.

Built-in names may be bound from several sources. Most come from the core interpreter directly, but some may come from loaded C extension modules or the interpreter binary. Kuroko source modules are also free to append new names to the built-in name space by attaching new properties to the __builtins__ instance.

Classes

_class Cell(object)

_Cell.__new__()

_property Cell.cell_contents

_class CompilerState(object)

_class Helper(object)

Special object that prints a helpeful message.

Object that prints help summary when passed to repr.

_Helper(obj=None)

Helper.__call__(obj=None)

Prints help text.

Prints the help documentation attached to obj or starts the interactive help system by importing the mod_help module.

_class LicenseReader(object)

Special object that prints Kuroko's copyright information when passed to repr

_LicenseReader()

LicenseReader.__call__()

Print the full license statement.

_class NoneType(object)

_NoneType == other

NoneType.__eq__()

_NoneType.__hash__()

_NoneType.__new__()

_class NotImplementedType(object)

_NotImplementedType == other

NotImplementedType.__eq__()

_NotImplementedType.__hash__()

_NotImplementedType.__new__()

_class bool(int)

Returns False if the argument is 'falsey', otherwise True.

_bool.__format__()

_bool.__new__()

_class bytearray(object)

_let x = bytearray(bytes=None)

bytearray.__init__(bytes=None)

A mutable array of bytes.

_needle in bytearray

bytearray.__contains__()

_bytearray == other

bytearray.__eq__()

_bytearray[key]

bytearray.__getitem__()

_for x in bytearray:

bytearray.__iter__()

_len(bytearray)

bytearray.__len__()

_bytearray[key] = value

bytearray.__setitem__()

_bytearray.decode()

_class bytes(object)

_bytes + other

bytes.__add__()

_needle in bytes

bytes.__contains__()

_bytes == other

bytes.__eq__()

_bytes[key]

bytes.__getitem__()

_bytes.__hash__()

_for x in bytes:

bytes.__iter__()

_len(bytes)

bytes.__len__()

_bytes.__new__(iter=None)

An array of bytes.

Creates a new bytes object. If iter is provided, it should be a tuple or list of integers within the range 0 and 255.

_bytes.decode()

_bytes.join()

_class bytesiterator(object)

_let x = bytesiterator()

bytesiterator.__init__()

_bytesiterator()

bytesiterator.__call__()

_class codeobject(object)

_codeobject.__new__()

_codeobject._ip_to_line()

_property codeobject.__args__

_property codeobject.__constants__

_property codeobject.__locals__

_property codeobject.co_argcount

_property codeobject.co_code

_property codeobject.co_flags

_property codeobject.co_kwonlyargcount

_property codeobject.co_posonlyargcount

_class dict(object)

Mapping of arbitrary keys to values.

_let x = dict()

dict.__init__()

_needle in dict

dict.__contains__()

_del dict[key]

dict.__delitem__()

_dict == other

dict.__eq__()

_dict[key]

dict.__getitem__()

_dict |= other

dict.__ior__()

_for x in dict:

dict.__iter__()

_len(dict)

dict.__len__()

_dict | other

dict.__or__()

_dict[key] = value

dict.__setitem__()

_dict.capacity()

_dict.clear()

_dict.copy()

_dict.get()

_dict.items()

_dict.keys()

_dict.setdefault()

_dict.update()

_dict.values()

_class dictitems(object)

_let x = dictitems()

dictitems.__init__()

_dictitems()

dictitems.__call__()

_for x in dictitems:

dictitems.__iter__()

_class dictkeys(object)

_let x = dictkeys()

dictkeys.__init__()

_dictkeys()

dictkeys.__call__()

_for x in dictkeys:

dictkeys.__iter__()

_class dictvalues(object)

_let x = dictvalues()

dictvalues.__init__()

_dictvalues()

dictvalues.__call__()

_for x in dictvalues:

dictvalues.__iter__()

_class ellipsis(object)

_ellipsis.__new__()

_class enumerate(object)

Return an iterator that produces a tuple with a count the iterated values of the passed iteratable.

_let x = enumerate()

enumerate.__init__()

_enumerate()

enumerate.__call__()

_for x in enumerate:

enumerate.__iter__()

_class filter(object)

Return an iterator that returns only the items from an iterable for which the given function returns true.

_let x = filter()

filter.__init__()

_filter()

filter.__call__()

_for x in filter:

filter.__iter__()

_class float(object)

Convert a number or string type to a float representation.

_float.__abs__()

_float + other

float.__add__()

_float == other

float.__eq__()

_float.__float__()

_float // other

float.__floordiv__()

_float.__format__()

_float >= other

float.__ge__()

_float > other

float.__gt__()

_float.__hash__()

_float += other

float.__iadd__()

_float //= other

float.__ifloordiv__()

_float *= other

float.__imul__()

_float.__int__()

_float -= other

float.__isub__()

_float /= other

float.__itruediv__()

_float <= other

float.__le__()

_float < other

float.__lt__()

_float * other

float.__mul__()

_-float

float.__neg__()

_float.__new__()

_float.__pos__()

_other + float

float.__radd__()

_other // float

float.__rfloordiv__()

_other * float

float.__rmul__()

_other - float

float.__rsub__()

_other / float

float.__rtruediv__()

_float - other

float.__sub__()

_float / other

float.__truediv__()

_float.as_integer_ratio()

_class function(object)

_function.__new__()

_function._ip_to_line()

_property function.__annotations__

_property function.__args__

_property function.__closure__

_property function.__code__

_property function.__doc__

_property function.__globals__

_property function.__qualname__

_class generator(object)

_let x = generator()

generator.__init__()

_generator()

generator.__call__()

_generator.__finish__()

_for x in generator:

generator.__iter__()

_generator.send()

_property generator.gi_running

_class int(object)

Convert a number or string type to an integer representation.

_int.__abs__()

_int + other

int.__add__()

_int & other

int.__and__()

_int.__bin__()

_int.__chr__()

_int == other

int.__eq__()

_int.__float__()

_int // other

int.__floordiv__()

_int.__format__()

_int >= other

int.__ge__()

_int > other

int.__gt__()

_int.__hash__()

_int.__hex__()

_int += other

int.__iadd__()

_int &= other

int.__iand__()

_int //= other

int.__ifloordiv__()

_int <<= other

int.__ilshift__()

_int %= other

int.__imod__()

_int *= other

int.__imul__()

_int.__int__()

_~int

int.__invert__()

_int |= other

int.__ior__()

_int **= other

int.__ipow__()

_int >>= other

int.__irshift__()

_int -= other

int.__isub__()

_int /= other

int.__itruediv__()

_int ^= other

int.__ixor__()

_int <= other

int.__le__()

_int << other

int.__lshift__()

_int < other

int.__lt__()

_int % other

int.__mod__()

_int * other

int.__mul__()

_-int

int.__neg__()

_int.__new__()

_int.__oct__()

_int | other

int.__or__()

_int.__pos__()

_int ** other

int.__pow__()

_other + int

int.__radd__()

_other & int

int.__rand__()

_other // int

int.__rfloordiv__()

_other << int

int.__rlshift__()

_other % int

int.__rmod__()

_other * int

int.__rmul__()

_other | int

int.__ror__()

_other ** int

int.__rpow__()

_other >> int

int.__rrshift__()

_int >> other

int.__rshift__()

_other - int

int.__rsub__()

_other / int

int.__rtruediv__()

_other ^ int

int.__rxor__()

_int - other

int.__sub__()

_int / other

int.__truediv__()

_int ^ other

int.__xor__()

_int.bit_count()

_int.bit_length()

_int.to_bytes()

_class list(object)

Mutable sequence of arbitrary values.

_let x = list()

list.__init__()

_list + other

list.__add__()

_needle in list

list.__contains__()

_del list[key]

list.__delitem__()

_list == other

list.__eq__()

_list >= other

list.__ge__()

_list[key]

list.__getitem__()

_list > other

list.__gt__()

_for x in list:

list.__iter__()

_list <= other

list.__le__()

_len(list)

list.__len__()

_list < other

list.__lt__()

_list * other

list.__mul__()

_list[key] = value

list.__setitem__()

_list.append(item)

Add an item to the end of the list.

Adds an item to the end of a list. Appending items to a list is an amortized constant-time operation, but may result in the reallocation of the list if not enough additional space is available to store to the new element in the current allocation.

_list.clear()

Empty a list.

Removes all entries from the list.

_list.copy()

Clone a list.

Equivalent to list[:], creates a new list with the same items as this list.

_list.count(val)

Count instances of a value in the list.

Scans the list for values equal to val and returns the count of matching entries.

_list.extend()

Add the contents of an iterable to the end of a list. @argument iterable

Adds all of the elements of iterable to the end of the list, as if each were added individually with _list_append.

_list.index(val,[min,[max]])

Locate an item in the list by value.

Searches for val in the list and returns its index if found. If min is provided, the search will begin at index min. If max is also provided, the search will end at index max. Raises ValueError if the item is not found.

_list.insert(index, val)

Add an entry to the list at a given offset.

Adds val to the list at offset index, moving all following items back. Inserting near the beginning of a list can be costly.

_list.pop([index])

Remove and return an element from the list.

Removes and returns the entry at the end of the list, or at index if provided. Popping from the end of the list is constant-time. Popping from the head of the list is always O(n) as the contents of the list must be shifted.

_list.remove(val)

Remove an item from the list.

Scans the list for an entry equivalent to val and removes it from the list. Raises ValueError if no matching entry is found.

_list.reverse()

Reverse the contents of a list.

Reverses the elements of the list in-place.

_list.sort()

Sort the contents of a list.

Performs an in-place sort of the elements in the list, returning None as a gentle reminder that the sort is in-place. If a sorted copy is desired, use sorted instead.

_class listiterator(object)

_let x = listiterator()

listiterator.__init__()

_listiterator()

listiterator.__call__()

_class long(int)

_long.__abs__()

_long + other

long.__add__()

_long & other

long.__and__()

_long.__bin__()

_long == other

long.__eq__()

_long.__float__()

_long // other

long.__floordiv__()

_long.__format__()

_long >= other

long.__ge__()

_long > other

long.__gt__()

_long.__hash__()

_long.__hex__()

_long += other

long.__iadd__()

_long &= other

long.__iand__()

_long //= other

long.__ifloordiv__()

_long <<= other

long.__ilshift__()

_long %= other

long.__imod__()

_long *= other

long.__imul__()

_long.__int__()

_~long

long.__invert__()

_long |= other

long.__ior__()

_long **= other

long.__ipow__()

_long >>= other

long.__irshift__()

_long -= other

long.__isub__()

_long /= other

long.__itruediv__()

_long ^= other

long.__ixor__()

_long <= other

long.__le__()

_len(long)

long.__len__()

_long << other

long.__lshift__()

_long < other

long.__lt__()

_long % other

long.__mod__()

_long * other

long.__mul__()

_-long

long.__neg__()

_long.__new__()

_long.__oct__()

_long | other

long.__or__()

_long.__pos__()

_long ** other

long.__pow__()

_other + long

long.__radd__()

_other & long

long.__rand__()

_other // long

long.__rfloordiv__()

_other << long

long.__rlshift__()

_other % long

long.__rmod__()

_other * long

long.__rmul__()

_other | long

long.__ror__()

_other ** long

long.__rpow__()

_other >> long

long.__rrshift__()

_long >> other

long.__rshift__()

_other - long

long.__rsub__()

_other / long

long.__rtruediv__()

_other ^ long

long.__rxor__()

_long - other

long.__sub__()

_long / other

long.__truediv__()

_long ^ other

long.__xor__()

_long._digit_count()

_long._get_digit()

_long.bit_count()

_long.bit_length()

_long.to_bytes()

_class map(object)

Return an iterator that applies a function to a series of iterables

_let x = map()

map.__init__()

_map()

map.__call__()

_for x in map:

map.__iter__()

_class method(object)

_method.__new__()

_method._ip_to_line()

_property method.__annotations__

_property method.__args__

_property method.__code__

_property method.__doc__

_property method.__qualname__

_property method.__self__

_class object()

Base class for all types.

The object base class provides the fallback implementations of methods like __dir__. All object and primitive types eventually inherit from object.

_let x = object()

object.__init__()

_object.__dir__()

_object == other

object.__eq__()

_object.__format__()

_object.__hash__()

_object.__new__()

_object.__setattr__()

_class property(object)

_let x = property(fget,[fset])

property.__init__(fget,[fset])

Create a property object.

When a property object is obtained from an instance of the class in which it is defined, the function or method assigned to fget is called with the instance as an argument. If fset is provided, it will be called with the instance and a value when the property object is assigned to through an instance. For legacy compatibility reasons, a property object's fget method may also accept an additional argument to act as a setter if fset is not provided, but this functionality may be removed in the future.

The typical use for property is as a decorator on methods in a class. See also property.setter for the newer Python-style approach to decorating a companion setter method.

_property.__get__()

_property.__set__()

_property.setter(fset)

Assign the setter method of a property object.

This should be used as a decorator from an existing property object as follows:

class Foo():
@property
def bar(self):
return 42
@bar.setter
def bar(self, val):
print('setting bar to',val)

Be sure to apply the decorator to a function or method with the same name, as this name will be used to assign the property to the class's attribute table; using a different name will create a duplicate alias.

_class range(object)

Iterable object that produces sequential numeric values.

_let x = range([min,] max, [step])

range.__init__([min,] max, [step])

Create an iterable that produces sequential numeric values.

With one argument, iteration will start at 0 and continue to max, exclusive. With two arguments, iteration starts at min and continues to max, exclusive. With three arguments, a step may also be included.

_needle in range

range.__contains__()

_for x in range:

range.__iter__()

_class rangeiterator(object)

_let x = rangeiterator()

rangeiterator.__init__()

_rangeiterator()

rangeiterator.__call__()

_class set(object)

_let x = set()

set.__init__()

_set & other

set.__and__()

_needle in set

set.__contains__()

_set == other

set.__eq__()

_set >= other

set.__ge__()

_set > other

set.__gt__()

_for x in set:

set.__iter__()

_set <= other

set.__le__()

_len(set)

set.__len__()

_set < other

set.__lt__()

_set | other

set.__or__()

_set ^ other

set.__xor__()

_set.add(value)

Add an element to the set.

Adds the given value to the set. value must be hashable.

_set.clear()

Empty the set.

Removes all elements from the set, in-place.

_set.discard(value)

Remove an element from the set, quietly.

Removes value from the set, without raising an exception if it is not a member.

_set.remove(value)

Remove an element from the set.

Removes value from the set, raising KeyError if it is not a member of the set.

_set.update()

_class setiterator(object)

_let x = setiterator()

setiterator.__init__()

_setiterator()

setiterator.__call__()

_class slice(object)

_let x = slice()

slice.__init__()

_property slice.end

_property slice.start

_property slice.step

_class str(object)

Obtain a string representation of an object.

_str + other

str.__add__()

_needle in str

str.__contains__()

_del str[key]

str.__delitem__()

_str.__float__()

_str.__format__()

_str >= other

str.__ge__()

_str[key]

str.__getitem__()

_str > other

str.__gt__()

_str.__hash__()

_str.__int__()

_for x in str:

str.__iter__()

_str <= other

str.__le__()

_len(str)

str.__len__()

_str < other

str.__lt__()

_str % other

str.__mod__()

_str * other

str.__mul__()

_str.__new__()

_str.__ord__()

_other * str

str.__rmul__()

_str[key] = value

str.__setitem__()

_str.encode()

_str.endswith()

_str.find()

_str.format()

_str.index()

_str.isalnum()

_str.isalpha()

_str.isdigit()

_str.islower()

_str.isspace()

_str.isupper()

_str.isxdigit()

_str.join()

_str.lower()

_str.lstrip()

_str.replace()

_str.rstrip()

_str.split()

_str.startswith()

_str.strip()

_str.title()

_str.upper()

_class striterator(object)

_let x = striterator()

striterator.__init__()

_striterator()

striterator.__call__()

_class tuple(object)

_tuple + other

tuple.__add__()

_needle in tuple

tuple.__contains__()

_tuple == other

tuple.__eq__()

_tuple >= other

tuple.__ge__()

_tuple[key]

tuple.__getitem__()

_tuple > other

tuple.__gt__()

_tuple.__hash__()

_for x in tuple:

tuple.__iter__()

_tuple <= other

tuple.__le__()

_len(tuple)

tuple.__len__()

_tuple < other

tuple.__lt__()

_tuple * other

tuple.__mul__()

_tuple.__new__()

_class tupleiterator(object)

_let x = tupleiterator()

tupleiterator.__init__()

_tupleiterator()

tupleiterator.__call__()

_class type(object)

Obtain the object representation of the class of an object.

_type()

type.__call__()

_type[key]

type.__getitem__()

_type.__new__()

_type.__subclasses__()

_class zip(object)

Returns an iterator that produces tuples of the nth element of each passed iterable. @arguments *iterables

Creates an iterator that returns a tuple of elements from each of iterables, until one of iterables is exhuasted.

_let x = zip()

zip.__init__()

_zip()

zip.__call__()

_for x in zip:

zip.__iter__()

Functions

_abs(iterable)

Obtain the absolute value of a numeric.

_all(iterable)

Returns True if every element in the given iterable is truthy, False otherwise.

_any(iterable)

Returns True if at least one element in the given iterable is truthy, False otherwise.

_bin(i)

Convert an integer value to a binary string.

Produces a string representation of i in binary, with a leading 0b.

_chr(codepoint)

Convert an integer codepoint to its string representation.

Creates a single-codepoint string with the character represented by the integer codepoint codepoint.

_classmethod()

A class method takes an implicit cls argument, instead of self.

_delattr(obj,attribute)

Delete an attribute by name.

Deletes the attribute attribute from obj.

_dir([obj])

Return a list of known property names for a given object.

Uses various internal methods to collect a list of property names of obj, returning that list sorted lexicographically. If no argument is given, the returned list will be the valid global names in the calling scope.

_format(value[,format_spec])

Format a value for string printing.

_getattr(obj,attribute,[default])

Perform attribute lookup on an object using a string.

Obtains the attributed named attribute from the object obj, if such an attribute exists. Attribute lookup ordering is complex and includes direct attribute tables of instances, dynamic attributes from classes, and so on. The use of getattr is equivalent to a dotted access. If attribute refers to a method of obj's class, a bound method will be obtained. If default is provided then the value supplied will be returned in the case where obj does not have an attribute named attribute, otherwise an AttributeError will be raised.

_globals()

Update and a return a mapping of names in the global namespace.

Produces a dict mapping all of the names of the current globals namespace to their values. Updating this dict has no meaning, but modifying mutable values within it can affect the global namespace.

_hasattr(obj,attribute)

Determines if an object has an attribute.

Uses getattr to determine if obj has an attribute named attribute.

_hash(val)

Returns the hash of a value, used for table indexing.

If val is hashable, its hash value will be calculated if necessary and returned. If val is not hashable, TypeError will be raised.

_hex(i)

Convert an integer value to a hexadecimal string.

Returns a string representation of i in hexadecimal, with a leading 0x.

_id(val)

Returns the identity of an object.

Returns the internal identity for val. Note that not all objects have identities; primitive values such as int or float do not have identities. Internally, this is the pointer value for a heap object, but this is an implementation detail.

_input(prompt='',promptwidth=0,syntax=None)

Read a line of input.

Read a line of input from stdin. If the rline library is available, it will be used to gather input. Input reading stops on end-of file or when a read ends with a line feed, which will be removed from the returned string. If a prompt is provided, it will be printed without a line feed before requesting input. If rline is available, the prompt will be passed to the library as the left-hand prompt string. If not provided, promptwidth will default to the width of prompt in codepoints; if you are providing a prompt with escape characters or characters with multi-column East-Asian Character Width be sure to pass a value for promptwidth that reflects the display width of your prompt. If provided, syntax specifies the name of an rline syntax module to provide color highlighting of the input line.

_isinstance(inst, cls)

Check if an object is an instance of a type.

Determine if an object inst is an instance of the given class cls or one if its subclasses. cls may be a single class or a tuple of classes.

_issubclass(cls, clsinfo)

Check if a class is a subclass of a type.

Determine if the class cls is a subclass of the class clsinfo. clsinfo may be a single class or a tuple of classes.

_len(seq)

Return the length of a given sequence object.

Returns the length of the sequence object seq, which must implement len.

_locals(callDepth=1)

Update and return a mapping of names in the current local scope.

Produces a dict mapping the names of the requested locals scope to their current stack values. If callDepth is provided, the locals of an outer call frame will be returned. If the requested call depth is out of range, an exception will be raised.

_max(iterable)

Return the highest value in an iterable or the passed arguments.

_min(iterable)

Return the lowest value in an iterable or the passed arguments.

_next(iterable)

Compatibility function. Calls an iterable.

_oct(i)

Convert an integer value to an octal string.

Returns a string representation of i in octal, with a leading 0o.

_ord(char)

Obtain the ordinal integer value of a codepoint or byte.

Returns the integer codepoint value of a single-character string char.

_print(*args,sep=' ',end='\n',file=None,flush=False)

Print text to the standard output.

Prints the string representation of each argument to the standard output. The keyword argument sep specifies the string to print between values. The keyword argument end specifies the string to print after all of the values have been printed.

_repr(val)

Produce a string representation of the given object.

Return a string representation of the given object through its repr method. repr strings should convey all information needed to recreate the object, if this is possible.

_reversed(iterable)

Return a reversed representation of an iterable.

Creates a new, reversed list from the elements of iterable.

_setattr(obj,attribute,value)

Set an attribute of an object using a string name.

Sets the attribute named by attribute of the object obj to value. If attribute refers to a property object or other descriptor, the descriptor's __set__ method will be called. If obj is a class, instance, or other type with its own attribute table, then the field will be updated. If obj is a type without an attribute table and no class property provides an overriding setter for attribute, an AttributeError will be raised.

_sorted(iterable)

Return a sorted representation of an iterable.

Creates a new, sorted list from the elements of iterable.

_staticmethod()

A static method does not take an implicit self or cls argument.

_sum(iterable,start=0)

add the elements of an iterable.

Continuously adds all of the elements from iterable to start and returns the result when iterable has been exhausted.

Exceptions

_class ArgumentError(TypeError)

_class AssertionError(Exception)

_class AttributeError(Exception)

_class BaseException(object)

_let x = BaseException()

BaseException.__init__()

_class Exception(BaseException)

_class IOError(Exception)

_class ImportError(Exception)

_class IndexError(Exception)

_class KeyError(Exception)

_class KeyboardInterrupt(BaseException)

_class NameError(Exception)

_class NotImplementedError(Exception)

_class OSError(Exception)

_class SyntaxError(Exception)

_class SystemError(Exception)

_class TypeError(Exception)

_class ValueError(Exception)

_class ZeroDivisionError(Exception)

Other Members

let Ellipsis = ellipsis

let NotImplemented = NotImplementedType

let help = Helper

let license = LicenseReader