22__all__ = [
"SimpleGenericMap"]
25from ._typehandling
import SimpleGenericMapS
26from ._GenericMap
import MutableGenericMap, AutoKeyMeta
30 """A `dict`-like `~collections.abc.MutableMapping` for use when sharing a
31 map between C++ and Python.
33 For compatibility
with C++, ``SimpleGenericMap`` has the following
36 - all keys must be of the same type
37 - values must be built-
in types
or subclasses of
42 added
from C++ may be copied when you retrieve them
from Python, making it
43 impossible to modify them
in-place. This issue does
not affect objects that
44 are added
from Python,
or objects that are always passed by
45 :cpp:
class:`shared_ptr`
in C++.
49 mapping : `collections.abc.Mapping`, optional
50 iterable : iterable, optional
51 dtype : `type`, optional
52 The type of key the map accepts. Not required
if ``mapping``
or
53 ``iterable``
is provided.
55 Aside
from the ``dtype`` keyword, a ``SimpleGenericMap`` takes the same
56 input arguments
as `dict`.
60 return cls({key: value
for key
in iterable})
63SimpleGenericMap.register(str, SimpleGenericMapS)
67_oldInit = SimpleGenericMapS.__init__
75 self.update(source, **kwargs)
def fromkeys(cls, iterable, value=None)
def __init__(self, source=None, **kwargs)
Interface supporting iteration over heterogenous containers.