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)
_class CompilerState(object)
_class Helper(object)
_class LicenseReader(object)
_class NoneType(object)
_class NotImplementedType(object)
_class bool(int)
_class bytearray(object)
_let x = bytearray(bytes=None)
A mutable array of bytes.
_needle in bytearray
_bytearray == other
_bytearray[key]
_for x in bytearray:
_len(bytearray)
_bytearray[key] = value
_bytearray.decode()
_class bytes(object)
_class bytesiterator(object)
_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()
_needle in dict
_del dict[key]
_dict == other
_dict[key]
_dict |= other
_for x in dict:
_len(dict)
_dict | other
_dict[key] = value
_dict.capacity()
_dict.clear()
_dict.copy()
_dict.get()
_dict.items()
_dict.keys()
_dict.setdefault()
_dict.update()
_dict.values()
_class dictitems(object)
_class dictkeys(object)
_class dictvalues(object)
_class ellipsis(object)
_class enumerate(object)
_class filter(object)
_class float(object)
Convert a number or string type to a float representation.
_float.__abs__()
_float + other
_float == other
_float.__float__()
_float // other
_float.__format__()
_float >= other
_float > other
_float.__hash__()
_float += other
_float //= other
_float *= other
_float.__int__()
_float -= other
_float /= other
_float <= other
_float < other
_float * other
_-float
_float.__new__()
_float.__pos__()
_other + float
_other // float
_other * float
_other - float
_other / float
_float - other
_float / other
_float.as_integer_ratio()
_class function(object)
_class generator(object)
_class int(object)
Convert a number or string type to an integer representation.
_int.__abs__()
_int + other
_int & other
_int.__bin__()
_int.__chr__()
_int == other
_int.__float__()
_int // other
_int.__format__()
_int >= other
_int > other
_int.__hash__()
_int.__hex__()
_int += other
_int &= other
_int //= other
_int <<= other
_int %= other
_int *= other
_int.__int__()
_~int
_int |= other
_int **= other
_int >>= other
_int -= other
_int /= other
_int ^= other
_int <= other
_int << other
_int < other
_int % other
_int * other
_-int
_int.__new__()
_int.__oct__()
_int | other
_int.__pos__()
_int ** other
_other + int
_other & int
_other // int
_other << int
_other % int
_other * int
_other | int
_other ** int
_other >> int
_int >> other
_other - int
_other / int
_other ^ int
_int - other
_int / other
_int ^ other
_int.bit_count()
_int.bit_length()
_int.to_bytes()
_class list(object)
Mutable sequence of arbitrary values.
_let x = list()
_list + other
_needle in list
_del list[key]
_list == other
_list >= other
_list[key]
_list > other
_for x in list:
_list <= other
_len(list)
_list < other
_list * other
_list[key] = value
_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)
_class long(int)
_long.__abs__()
_long + other
_long & other
_long.__bin__()
_long == other
_long.__float__()
_long // other
_long.__format__()
_long >= other
_long > other
_long.__hash__()
_long.__hex__()
_long += other
_long &= other
_long //= other
_long <<= other
_long %= other
_long *= other
_long.__int__()
_~long
_long |= other
_long **= other
_long >>= other
_long -= other
_long /= other
_long ^= other
_long <= other
_len(long)
_long << other
_long < other
_long % other
_long * other
_-long
_long.__new__()
_long.__oct__()
_long | other
_long.__pos__()
_long ** other
_other + long
_other & long
_other // long
_other << long
_other % long
_other * long
_other | long
_other ** long
_other >> long
_long >> other
_other - long
_other / long
_other ^ long
_long - other
_long / other
_long ^ other
_long._digit_count()
_long._get_digit()
_long.bit_count()
_long.bit_length()
_long.to_bytes()
_class map(object)
_class method(object)
_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.__dir__()
_object == other
_object.__format__()
_object.__hash__()
_object.__new__()
_object.__setattr__()
_class property(object)
_let x = property(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:
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])
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
_for x in range:
_class rangeiterator(object)
_class set(object)
_let x = set()
_set & other
_needle in set
_set == other
_set >= other
_set > other
_for x in set:
_set <= other
_len(set)
_set < other
_set | other
_set ^ other
_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)
_class slice(object)
_class str(object)
Obtain a string representation of an object.
_str + other
_needle in str
_del str[key]
_str.__float__()
_str.__format__()
_str >= other
_str[key]
_str > other
_str.__hash__()
_str.__int__()
_for x in str:
_str <= other
_len(str)
_str < other
_str % other
_str * other
_str.__new__()
_str.__ord__()
_other * str
_str[key] = value
_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)
_class tuple(object)
_tuple + other
_needle in tuple
_tuple == other
_tuple >= other
_tuple[key]
_tuple > other
_tuple.__hash__()
_for x in tuple:
_tuple <= other
_len(tuple)
_tuple < other
_tuple * other
_tuple.__new__()
_class tupleiterator(object)
_class type(object)
_class zip(object)
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.