classes/pydict.pmc - Python Dictionary


These are the vtable functions for the Python Dictionary class

Methods ^

static size_t key_hash_object(Interp *interpreter, Hash *hash, void *value)

Return the hashed value of the object value.

static int object_compare(Interp *interp, void *a, void *b)

Compares the two objects, return 0 if they are identical.

a is the search key, b is the bucket key.

void class_init()

Class initialization. Allocates the memory for the hash.

void init()

Initializes the instance.

void mark()

Marks the hash as live.

void delete_keyed(PMC *key)

Deletes the element associated with *key.

INTVAL elements()

Returns the number of elements in the hash.

INTVAL exists_keyed(PMC *key)

Returns whether a key *key exists in the hash.

PMC* "fromkeys" (PMC *self, PMC *keys, PMC *value)

Create a new dict with the specified keys and value. If value is not specified, it defaults to None.

INTVAL get_bool()

Returns true iff there are elements in the dictionary.

PMC *get_class()

Return the class of this object.

PMC *get_iter ()

Return a new iterator for dictionary

PMC *get_pmc_keyed(PMC *key)

Returns the PMC value for the element at *key.

PMC *get_pmc_keyed_str(STRING *key)

STRING *get_string()

Returns a string representation of the dictionary.

STRING *get_string_keyed(PMC *key)

Returns the big number value for the element at *key.

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

Create a new dictionary from a sequence

void set_integer_keyed(PMC *key, STRING *value)

INTVAL is_equal(PMC *value)

The == operation.

Check if two dictionaries hold the same keys and values.

void set_pmc_keyed(PMC *key, PMC *value)

void set_string_keyed(PMC *key, STRING *value)