| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -477,3 +477,92 @@ Dictionary View Objects | |||
| 477 | 477 | ||
| 478 | 478 | Return true if *op* is an instance of a dictionary items view. This function | |
| 479 | 479 | always succeeds. | |
| 480 | + | ||
| 481 | + | ||
| 482 | + Ordered Dictionaries | ||
| 483 | + ^^^^^^^^^^^^^^^^^^^^ | ||
| 484 | + | ||
| 485 | + Python's C API provides interface for :class:`collections.OrderedDict` from C. | ||
| 486 | + Since Python 3.7, dictionaries are ordered by default, so there is usually | ||
| 487 | + little need for these functions; prefer ``PyDict*`` where possible. | ||
| 488 | + | ||
| 489 | + | ||
| 490 | + .. c:var:: PyTypeObject PyODict_Type | ||
| 491 | + | ||
| 492 | + Type object for ordered dictionaries. This is the same object as | ||
| 493 | + :class:`collections.OrderedDict` in the Python layer. | ||
| 494 | + | ||
| 495 | + | ||
| 496 | + .. c:function:: int PyODict_Check(PyObject *od) | ||
| 497 | + | ||
| 498 | + Return true if *od* is an ordered dictionary object or an instance of a | ||
| 499 | + subtype of the :class:`~collections.OrderedDict` type. This function | ||
| 500 | + always succeeds. | ||
| 501 | + | ||
| 502 | + | ||
| 503 | + .. c:function:: int PyODict_CheckExact(PyObject *od) | ||
| 504 | + | ||
| 505 | + Return true if *od* is an ordered dictionary object, but not an instance of | ||
| 506 | + a subtype of the :class:`~collections.OrderedDict` type. | ||
| 507 | + This function always succeeds. | ||
| 508 | + | ||
| 509 | + | ||
| 510 | + .. c:var:: PyTypeObject PyODictKeys_Type | ||
| 511 | + | ||
| 512 | + Analogous to :c:type:`PyDictKeys_Type` for ordered dictionaries. | ||
| 513 | + | ||
| 514 | + | ||
| 515 | + .. c:var:: PyTypeObject PyODictValues_Type | ||
| 516 | + | ||
| 517 | + Analogous to :c:type:`PyDictValues_Type` for ordered dictionaries. | ||
| 518 | + | ||
| 519 | + | ||
| 520 | + .. c:var:: PyTypeObject PyODictItems_Type | ||
| 521 | + | ||
| 522 | + Analogous to :c:type:`PyDictItems_Type` for ordered dictionaries. | ||
| 523 | + | ||
| 524 | + | ||
| 525 | + .. c:function:: PyObject *PyODict_New(void) | ||
| 526 | + | ||
| 527 | + Return a new empty ordered dictionary, or ``NULL`` on failure. | ||
| 528 | + | ||
| 529 | + This is analogous to :c:func:`PyDict_New`. | ||
| 530 | + | ||
| 531 | + | ||
| 532 | + .. c:function:: int PyODict_SetItem(PyObject *od, PyObject *key, PyObject *value) | ||
| 533 | + | ||
| 534 | + Insert *value* into the ordered dictionary *od* with a key of *key*. | ||
| 535 | + Return ``0`` on success or ``-1`` with an exception set on failure. | ||
| 536 | + | ||
| 537 | + This is analogous to :c:func:`PyDict_SetItem`. | ||
| 538 | + | ||
| 539 | + | ||
| 540 | + .. c:function:: int PyODict_DelItem(PyObject *od, PyObject *key) | ||
| 541 | + | ||
| 542 | + Remove the entry in the ordered dictionary *od* with key *key*. | ||
| 543 | + Return ``0`` on success or ``-1`` with an exception set on failure. | ||
| 544 | + | ||
| 545 | + This is analogous to :c:func:`PyDict_DelItem`. | ||
| 546 | + | ||
| 547 | + | ||
| 548 | + These are :term:`soft deprecated` aliases to ``PyDict`` APIs: | ||
| 549 | + | ||
| 550 | + | ||
| 551 | + .. list-table:: | ||
| 552 | + :widths: auto | ||
| 553 | + :header-rows: 1 | ||
| 554 | + | ||
| 555 | + * * ``PyODict`` | ||
| 556 | + * ``PyDict`` | ||
| 557 | + * * .. c:macro:: PyODict_GetItem(od, key) | ||
| 558 | + * :c:func:`PyDict_GetItem` | ||
| 559 | + * * .. c:macro:: PyODict_GetItemWithError(od, key) | ||
| 560 | + * :c:func:`PyDict_GetItemWithError` | ||
| 561 | + * * .. c:macro:: PyODict_GetItemString(od, key) | ||
| 562 | + * :c:func:`PyDict_GetItemString` | ||
| 563 | + * * .. c:macro:: PyODict_Contains(od, key) | ||
| 564 | + * :c:func:`PyDict_Contains` | ||
| 565 | + * * .. c:macro:: PyODict_Size(od) | ||
| 566 | + * :c:func:`PyDict_Size` | ||
| 567 | + * * .. c:macro:: PyODict_SIZE(od) | ||
| 568 | + * :c:func:`PyDict_GET_SIZE` | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -108,6 +108,7 @@ Other Iterator Objects | |||
| 108 | 108 | .. c:var:: PyTypeObject PyDictRevIterValue_Type | |
| 109 | 109 | .. c:var:: PyTypeObject PyDictIterItem_Type | |
| 110 | 110 | .. c:var:: PyTypeObject PyDictRevIterItem_Type | |
| 111 | + .. c:var:: PyTypeObject PyODictIter_Type | ||
| 111 | 112 | ||
| 112 | 113 | Type objects for iterators of various built-in objects. | |
| 113 | 114 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments