SortedKeyDict
Bases: BaseSortedDict[K, V]
flowchart TD
pyochain.collections._sorted._dict.SortedKeyDict[SortedKeyDict]
pyochain.collections._sorted._dict.BaseSortedDict[BaseSortedDict]
pyochain.abc._mappings.PyoMutableMapping[PyoMutableMapping]
pyochain.abc._mappings.PyoMapping[PyoMapping]
pyochain.abc._collection.PyoCollection[PyoCollection]
pyochain.collections._sorted._core.SortedCollection[SortedCollection]
pyochain.abc._sequences.PyoReversible[PyoReversible]
pyochain.abc._iterable.PyoIterable[PyoIterable]
pyochain.abc._collection.PyoContainer[PyoContainer]
pyochain.abc._collection.PyoSized[PyoSized]
pyochain.abc._mixins.Checkable[Checkable]
pyochain.abc._mixins.Fluent[Fluent]
pyochain.abc._mixins.Pipe[Pipe]
pyochain.abc._mixins.Tap[Tap]
pyochain.collections._sorted._dict.BaseSortedDict --> pyochain.collections._sorted._dict.SortedKeyDict
pyochain.abc._mappings.PyoMutableMapping --> pyochain.collections._sorted._dict.BaseSortedDict
pyochain.abc._mappings.PyoMapping --> pyochain.abc._mappings.PyoMutableMapping
pyochain.abc._collection.PyoCollection --> pyochain.abc._mappings.PyoMapping
pyochain.abc._iterable.PyoIterable --> pyochain.abc._collection.PyoCollection
pyochain.abc._mixins.Checkable --> pyochain.abc._iterable.PyoIterable
pyochain.abc._mixins.Fluent --> pyochain.abc._iterable.PyoIterable
pyochain.abc._mixins.Pipe --> pyochain.abc._mixins.Fluent
pyochain.abc._mixins.Tap --> pyochain.abc._mixins.Fluent
pyochain.abc._collection.PyoContainer --> pyochain.abc._collection.PyoCollection
pyochain.abc._mixins.Checkable --> pyochain.abc._collection.PyoContainer
pyochain.abc._collection.PyoSized --> pyochain.abc._collection.PyoCollection
pyochain.abc._mixins.Checkable --> pyochain.abc._collection.PyoSized
pyochain.collections._sorted._core.SortedCollection --> pyochain.collections._sorted._dict.BaseSortedDict
pyochain.abc._sequences.PyoReversible --> pyochain.collections._sorted._dict.BaseSortedDict
pyochain.abc._iterable.PyoIterable --> pyochain.abc._sequences.PyoReversible
pyochain.abc._mixins.Checkable --> pyochain.abc._iterable.PyoIterable
pyochain.abc._mixins.Fluent --> pyochain.abc._iterable.PyoIterable
pyochain.abc._mixins.Pipe --> pyochain.abc._mixins.Fluent
pyochain.abc._mixins.Tap --> pyochain.abc._mixins.Fluent
click pyochain.collections._sorted._dict.SortedKeyDict href "" "pyochain.collections._sorted._dict.SortedKeyDict"
click pyochain.collections._sorted._dict.BaseSortedDict href "" "pyochain.collections._sorted._dict.BaseSortedDict"
click pyochain.abc._mappings.PyoMutableMapping href "" "pyochain.abc._mappings.PyoMutableMapping"
click pyochain.abc._mappings.PyoMapping href "" "pyochain.abc._mappings.PyoMapping"
click pyochain.abc._collection.PyoCollection href "" "pyochain.abc._collection.PyoCollection"
click pyochain.collections._sorted._core.SortedCollection href "" "pyochain.collections._sorted._core.SortedCollection"
click pyochain.abc._sequences.PyoReversible href "" "pyochain.abc._sequences.PyoReversible"
click pyochain.abc._iterable.PyoIterable href "" "pyochain.abc._iterable.PyoIterable"
click pyochain.abc._collection.PyoContainer href "" "pyochain.abc._collection.PyoContainer"
click pyochain.abc._collection.PyoSized href "" "pyochain.abc._collection.PyoSized"
click pyochain.abc._mixins.Checkable href "" "pyochain.abc._mixins.Checkable"
click pyochain.abc._mixins.Fluent href "" "pyochain.abc._mixins.Fluent"
click pyochain.abc._mixins.Pipe href "" "pyochain.abc._mixins.Pipe"
click pyochain.abc._mixins.Tap href "" "pyochain.abc._mixins.Tap"
Sorted dict with key-function for sorting keys.
Optional key-function argument defines a callable that, like the key
argument to the built-in sorted function, extracts a comparison key
from each dictionary key.
If no function is specified, the default compares the dictionary keys directly.
The key-function argument must be provided as a positional argument and must come before all other arguments.
Optional iterable argument provides an initial sequence of pairs to initialize the sorted dict.
Each pair in the sequence defines the key and corresponding value.
If a key is seen more than once, the last value associated with it is stored in the new sorted dict.
Optional mapping argument provides an initial mapping of items to initialize the sorted dict.
If keyword arguments are given, the keywords themselves, with their associated values, are added as items to the dictionary.
If a key is specified both in the positional argument and as a keyword argument, the value associated with the keyword is stored in the sorted dict.
Sorted dict keys must be hashable, per the requirement for Python's dictionaries.
The result of the key-function must also be comparable, per the requirement for sorted lists.
from pyochain.collections import SortedDict
d = {"alpha": 1, "beta": 2}
assert SortedDict([("alpha", 1), ("beta", 2)]) == d
assert SortedDict({"alpha": 1, "beta": 2}) == d
assert SortedDict(alpha=1, beta=2) == d
Source code in pyochain/collections/_sorted/_dict.pyi
464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 | |
key
property
Function used to extract comparison key from keys.
Sorted dict compares keys directly when the key function is none.