Movatterモバイル変換


[0]ホーム

URL:


Navigation

Mapping Protocol

intPyMapping_Check(PyObject *o)

Return1 if the object provides mapping protocol, and0 otherwise. Thisfunction always succeeds.

Py_ssize_tPyMapping_Size(PyObject *o)
Py_ssize_tPyMapping_Length(PyObject *o)

Returns the number of keys in objecto on success, and-1 on failure. Forobjects that do not provide mapping protocol, this is equivalent to the Pythonexpressionlen(o).

intPyMapping_DelItemString(PyObject *o, char *key)

Remove the mapping for objectkey from the objecto. Return-1 onfailure. This is equivalent to the Python statementdelo[key].

intPyMapping_DelItem(PyObject *o,PyObject *key)

Remove the mapping for objectkey from the objecto. Return-1 onfailure. This is equivalent to the Python statementdelo[key].

intPyMapping_HasKeyString(PyObject *o, char *key)

On success, return1 if the mapping object has the keykey and0otherwise. This is equivalent to the Python expressionkeyino.This function always succeeds.

intPyMapping_HasKey(PyObject *o,PyObject *key)

Return1 if the mapping object has the keykey and0 otherwise. Thisis equivalent to the Python expressionkeyino. This function alwayssucceeds.

PyObject*PyMapping_Keys(PyObject *o)
Return value: New reference.

On success, return a list of the keys in objecto. On failure, returnNULL.This is equivalent to the Python expressionlist(o.keys()).

PyObject*PyMapping_Values(PyObject *o)
Return value: New reference.

On success, return a list of the values in objecto. On failure, returnNULL. This is equivalent to the Python expressionlist(o.values()).

PyObject*PyMapping_Items(PyObject *o)
Return value: New reference.

On success, return a list of the items in objecto, where each item is a tuplecontaining a key-value pair. On failure, returnNULL. This is equivalent tothe Python expressionlist(o.items()).

PyObject*PyMapping_GetItemString(PyObject *o, char *key)
Return value: New reference.

Return element ofo corresponding to the objectkey orNULL on failure.This is the equivalent of the Python expressiono[key].

intPyMapping_SetItemString(PyObject *o, char *key,PyObject *v)

Map the objectkey to the valuev in objecto. Returns-1 on failure.This is the equivalent of the Python statemento[key]=v.

Previous topic

Sequence Protocol

Next topic

Iterator Protocol

This Page

Quick search

Enter search terms or a module, class or function name.

Navigation

©Copyright 1990-2017, Python Software Foundation.
The Python Software Foundation is a non-profit corporation.Please donate.
Last updated on Sep 19, 2017.Found a bug?
Created usingSphinx 1.2.

[8]ページ先頭

©2009-2025 Movatter.jp