org.python.core
public class PyDictionary extends PyObject
Field Summary | |
---|---|
static String | exposed_name |
Constructor Summary | |
---|---|
PyDictionary()
Create an empty dictionary. | |
PyDictionary(PyType subtype)
For derived types | |
PyDictionary(Hashtable t)
Create an new dictionary which is based on the hashtable. | |
PyDictionary(PyObject[] elements)
Create a new dictionary with the element as content. |
Method Summary | |
---|---|
void | clear()
Remove all items from the dictionary. |
PyDictionary | copy()
Return a shallow copy of the dictionary. |
static PyObject | fromkeys(PyObject keys) |
static PyObject | fromkeys(PyObject keys, PyObject value) |
PyObject | get(PyObject key, PyObject default_object)
Return this[key] if the key exists in the mapping, default_object
is returned otherwise.
|
PyObject | get(PyObject key)
Return this[key] if the key exists in the mapping, None
is returned otherwise.
|
int | hashCode() |
boolean | has_key(PyObject key)
Return true if the key exist in the dictionary. |
boolean | isSequenceType() |
PyList | items()
Return a copy of the dictionarys list of (key, value) tuple
pairs. |
PyObject | iteritems()
Return an interator over (key, value) pairs. |
PyObject | iterkeys()
Return an interator over (key, value) pairs. |
PyObject | itervalues()
Return an interator over (key, value) pairs. |
PyList | keys()
Return a copy of the dictionarys list of keys. |
PyObject | pop(PyObject key)
Return a value based on key
from the dictionary. |
PyObject | pop(PyObject key, PyObject defaultValue)
Return a value based on key
from the dictionary or default if that key is not found. |
PyObject | popitem()
Return a random (key, value) tuple pair and remove the pair
from the dictionary. |
PyObject | setdefault(PyObject key)
Return this[key] if the key exist, otherwise insert key with
a None value and return None.
|
PyObject | setdefault(PyObject key, PyObject failobj)
Return this[key] if the key exist, otherwise insert key with
the value of failobj and return failobj
|
String | toString() |
static void | typeSetup(PyObject dict, PyType.Newstyle marker) |
void | update(PyObject d)
Insert all the key:value pairs from d into
this dictionary. |
PyList | values()
Return a copy of the dictionarys list of values. |
int | __cmp__(PyObject ob_other) |
void | __delitem__(PyObject key) |
PyObject | __eq__(PyObject ob_other) |
PyObject | __finditem__(int index) |
PyObject | __finditem__(PyObject key) |
PyObject | __iter__() |
int | __len__() |
PyObject | __ne__(PyObject ob_other) |
boolean | __nonzero__() |
void | __setitem__(PyObject key, PyObject value) |
Parameters: subtype
Parameters: t the hashtable used. The supplied hashtable is used as is and must only contain PyObject key:value pairs.
Parameters: elements The initial elements that is inserted in the dictionary. Even numbered elements are keys, odd numbered elements are values.
Parameters: key the key to lookup in the dictionary. default_object the value to return if the key does not exists in the mapping.
Parameters: key the key to lookup in the dictionary.
Parameters: key the key to lookup in the dictionary.
Parameters: key the key to lookup in the dictionary. failobj the default value to insert in the dictionary if key does not already exist.
d
into
this dictionary.