HPy Dict¶
-
int
HPyDict_Check(HPyContext *ctx, HPy h)¶
[source] Tests if an object is an instance of a Python dict.
- Parameters
ctx – The execution context.
h – A handle to an arbitrary object (must not be
HPy_NULL).
- Returns
Non-zero if object
his an instance of typedictor an instance of a subtype ofdict, and0otherwise.
-
HPy
HPyDict_New(HPyContext *ctx)¶
[source] Creates a new empty Python dictionary.
- Parameters
ctx – The execution context.
- Returns
A handle to the new and empty Python dictionary or
HPy_NULLin case of an error.
-
HPy
HPyDict_Keys(HPyContext *ctx, HPy h)¶
[source] Returns a list of all keys from the dictionary.
Note: This function will directly access the storage of the dict object and therefore ignores if method
keyswas overwritten.- Parameters
ctx – The execution context.
h – A Python dict object. If this argument is
HPy_NULLor not an instance of a Python dict, aSystemErrorwill be raised.
- Returns
A Python list object containing all keys of the given dictionary or
HPy_NULLin case of an error.
-
HPy
HPyDict_Copy(HPyContext *ctx, HPy h)¶
[source] Creates a copy of the provided Python dict object.
- Parameters
ctx – The execution context.
h – A Python dict object. If this argument is
HPy_NULLor not an instance of a Python dict, aSystemErrorwill be raised.
- Returns
Return a new dictionary that contains the same key-value pairs as
horHPy_NULLin case of an error.