NAME ^

pmc/pybuiltin.pmc - Python "builtin" Functions

DESCRIPTION ^

This class implements the Python "builtin" Functions.

Methods ^

void class_init()

Class initialization. Caches the type id of various PMCs because they will be used frequently here.

PMC* "__load__"()

This is unabashed hackery scaffolding. It copies all the builtins functions from globals to lexically scoped variables.

PMC* "abs"()

Returns the absolute value of an object

PMC* "callable"(PMC *object)

Returns the absolute value of an object

PMC* "chr"(PMC *value)

Return a string of one character with ordinal *value.

PMC* "cmp"(PMC *value1, PMC *value2)

Returns the result of comparing *value1 with *value2).

PMC* "divmod"(PMC *value1, PMC *value2)

Returns both the floordiv and mod of *value1 with *value2).

PMC* "enumerate"(PMC *list)

Iterator for index, value of iterable.

PMC* "filter"(PMC *func, PMC *list)

Combines a real and imaginary number and returns the result. Return those it ems of sequence for which function(item) is true. If function is None, return the items that are true. If sequence is a tuple or string, return the same type, else return a list.

PMC* "hash"(PMC *value)

Returns the hash of value.

PMC* "hasattr"(PMC *object, PMC *name)

Return whether the object has an attribute with the given name.

PMC* "getattr"(PMC *object, PMC *name)

Get the attribute with the given name.

PMC* "len"(PMC *object)

Return the number of elements in a given object.

PMC* "setattr"(PMC *object, PMC *name, PMC *value)

Sets the attribute with the given name.

PMC* "hex"(PMC *value)

Returns the hex representation of value.

PMC* "id"(PMC *value)

Returns the "identity" of value.

PMC* "isinstance"(PMC *object, PMC *class)

Returns the "identity" of value.

PMC* "iter"(PMC *obj)

Returns an iterator over a sequence.

PMC* "max"(PMC *value)

Returns the maximum of a set of values.

PMC* "map"(PMC *value)

Return a list of the result s of applying the function to the items of the argument sequence(s).

PMC* "min"(PMC *value)

Returns the minimum of a set of values.

PMC* "oct"(PMC *value)

Returns the octal representation of value.

PMC* "ord"(PMC *value)

Return the integer ordinal of a one-character string.

PMC* "range"(PMC *pstart, PMC *pend, PMC *pstep)

Returns a list of integers ranging from pstart to pend with an increment of pstep

PMC* "reduce"(PMC *func, PMC *list, PMC *init)

Apply a function of two arguments cumulatively to the items of a sequence, from left to right, so as to reduce the sequence to a single value. If initial is present, it is placed before the items of the sequence in the calculation, and serves as a default whe n the sequence is empty.

PMC* "repr"(PMC *value)

Returns the representation of value.


parrot