Title: Theory / Unimportant / CS / Programming / Python / Lib / 2 Built-in functions
Tags: FromInstruction computer_to_instruction hasNotNewEffectReturnsMeaning automatedNewLineAfterCommaSpace type
On every note of this deck, unless a note says otherwise:
Page: https://docs.python.org/3.3/library/functions.html
Language: Python

Instruction: abs(foo)
Returns: absolute value or magnitude of foo

Instruction: all(foo)
Returns: Whether all elements of the iterable foo are True

Instruction: any(foo)
Returns: Whether some element of the iterable foo are True

Instruction: ascii(foo)
Returns: escape the non-ASCII characters in the string returned by repr() using \x, \u or \U escapes

Instruction: bin(foo)
Returns: A binary encoding of foo or of foo.__index__()
Variables: foo either an integer or a value which can be coerced to one
Typ: A string

Instruction: bool(foo)
Returns: the Boolean value of foo

Typ: bytearray
Meaning: a mutable sequence of integers in the range 0 <= x < 256.
Page: https://docs.python.org/3.3/library/functions.html
Language: Python

Instruction: bytearray(foo)
Returns: A bytearray of size foo
Assuming: foo an integer

Instruction: bytearray(foo)
Returns: A bytearray initialized using a read-only buffer of the object
Assuming: foo an object, of buffer interface

Instruction: bytearray(foo)
Returns: A bytearray initialized using the elements of foo
Assuming: foo an iterable, whose objects are in 0<=x<256

Instruction: bytearray(foo, bar)
Returns: A bytearray initialized with the string foo using encoding bar

Instruction: bytes(foos)
Returns: Equivalent to bytearray(foos), but with type bytes

Instruction: callable(foo)
Returns: Whether foo is callable

Instruction: chr(foo)
Returns: the string representing a character whose Unicode codepoint is the integer foo.

Instruction: @classmethod
Returns: Ensure that the first argument's value of the next method is the class and not the object

Instruction: compile(
  foo,
  bar,
  plop
)
Returns: A code object obtained by compiling foo, assuming it comes from file bar with mode plop

Instruction: complex(
  foo,
  bar
)
Returns: the complex number foo+ i bar
Variables: foo,
  bar: Python float/int
Abbreviation: foo + barj

Instruction: foo.__complex__()
Returns: the complex number represented by the string foo
Variables: foo a string
Abbreviation: complex(foo)

Instruction: delattr(foo,bar)
Effect: foo.__delattr__(bar)
Typ: del foo.bar

Instruction: dict(foo)
Returns: A dictionnary according to parameters foo

Instruction: dir()
Returns: the list of names in the current local scope

Instruction: dir(foo)
Returns: A list of valid attributes for the object foo.
Using foo.__dir__() by default
Otherwise, from foo.__getattr__()
Variables: foo is not a module, type or class

Instruction: dir(foo)
Returns: the names of the attributes of foo, and recursively of the attributes of its bases.
Variables: foo a type

Instruction: dir(foo)
Returns: the names of the attributes of foo, and recursively of the attributes of its bases.
Variables: foo a class object

Instruction: a.__divmod__(b)
Returns: A pair (q,r) such that q*b+r is close to a.
r has the sign of b
abs (r)< abs(b)
Abbreviation: divmod(a,b)

Instruction: enumerate(foo)
Returns: A list of pair (i,elt) with elt the elements of the iterable foo and i the position in the list

Instruction: enumerate(foo,bar)
Returns: A list of pair (i,elt) with elt the elements of the iterable foo and i the position in the list, assuming first element is at position bar

Instruction: eval(
  expression,
  globals=None,
  locals=None
)
Returns: The expression argument - parsed and evaluated as a Python expression using the globals and locals dictionaries as global and local namespace.
Extra: Technically, the string is  interpreted as (a condition list)
If the globals dictionary is present and lacks ‘__builtins__’, the current globals are copied into globals before expression is parsed. This means that expression normally has full access to the standard builtins module and restricted environments are propagated. If the locals dictionary is omitted it defaults to the globals dictionary. If both dictionaries are omitted, the expression is executed in the environment where eval(  ) is called.
Exception: Syntax errors are reported as exceptions.

Instruction: exec(
  expression,
  globals=None,
  locals=None
)
Effect: Execute code passed in first argument, using either current global and local, or the one passed in arguments
Returns: None
Variables: object must be either a string or a code object.

Instruction: filter(
  foo,
  bar
)
Returns: An iterator for the element elt of bar satisfying foo(  elt) (  if foo is None, the identity function is used)

Instruction: foo.__float__()
Effect: Raise overflowError if the value is too big
Returns: a floating point number equivalent to foo
Abbreviation: float(foo)

Instruction: file=file
Effect: change the place where text is printed
Context: print
Example: sys.stderr