Open ashrub-holvi opened 11 months ago
also MappingProxyType
can be allowed instead of dictionary
The TypeError
comes from PyO3. It’s not clear to me from the PyO3 arg docs if there’s an easy way to allow all kinds of mappings or sets and have PyO3 convert them.
Adding support for frozenset
in https://github.com/PyO3/pyo3/pull/3632
Thank you! Do you think it's possible to add support of MappingProxyType? As I understand it's only way to have read-only dictionaries without adding third-party libraries.
Now it's
dict[str, set[str]]
, and attempt to usefrozenset
will returnbut IMO using
frozenset
is a good practice, because if data is immutable good to use immutable type, for example allowed attributes can be defined in configuration and it's safer to use immutable type.