classes/pytype.pmc - Python Class


These are the vtable functions for the Python Type base class (i.e., methods you would expect to see on Python Classes

Methods ^

void add_method(STRING *method_name, PMC *sub)

Store the method as a property of this class.

PMC *find_method(STRING *method_name)

Looks up the method for *method_name and returns it.

PMC *get_attr_str(STRING *name)

Return attribute named name.

PMC *get_class()

Return the class of this object.

void *invoke(void *next)

Pythonic object constructor.

PMC *subclass(STRING *name)

Create a subclass of the given class. Note that this merely creates a new PyType... all the interesting details that make it a subclass need to be filled in.

STRING *name()

Returns the name of this class.


    STRING* name() {
        PMC *name = VTABLE_getprop(INTERP, SELF, PyString_name);
        return VTABLE_get_string(INTERP, name);

PMC* "__new__"(PMC *class, PMC *source)

Create a new integer