FromKwargs
Bases: FromIter[tuple[K, V]], ABC
flowchart TD
pyochain.abc.constructors.FromKwargs[FromKwargs]
pyochain.abc.constructors.FromIter[FromIter]
pyochain.abc.constructors.FromIter --> pyochain.abc.constructors.FromKwargs
click pyochain.abc.constructors.FromKwargs href "" "pyochain.abc.constructors.FromKwargs"
click pyochain.abc.constructors.FromIter href "" "pyochain.abc.constructors.FromIter"
Source code in pyochain/abc/constructors.pyi
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
of(**elements)
abstractmethod
staticmethod
Create the instance from a variable number of keyword arguments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**elements
|
E
|
The elements to create the instance from. |
{}
|
Returns:
| Type | Description |
|---|---|
FromKwargs[str, E]
|
FromKwargs[str, E]: A new instance containing the provided |
Example
from pyochain import Dict
d = Dict.of(a=1, b=2)
assert d == Dict(a=1, b=2)
assert repr(d) == "Dict('a': 1, 'b': 2)"
assert Dict.of(a=1, b=2, c=3) == Dict({"a": 1, "b": 2, "c": 3})
Source code in pyochain/abc/constructors.pyi
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |