-
-
Notifications
You must be signed in to change notification settings - Fork 140
Let default_field_resolver check "typing.Mapping" instead of the more restrictive "dict" #102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Sounds like a good idea. But we need to explore these questions:
|
Those are very good questions. Thank you for testing the performance. I wonder if there is a good way to benchmark the impact on the whole process of resolving an object structure. |
It is hardly measurable with our standard benchmarks and probably doesn't matter much in real life as well. So I've implemented this now and added a test using ChainMap. I've used abc.collections.Mapping because typing.Mapping is intended to be used for type checking, not for runtime checks, and more or less only proxies the checks anyway. Will be available in the next release. |
Thank you very much! |
Feature requests
The current
default_field_resolver
checks against instances ofdict
specifically to decide whether to useget
orgetattr
to access the field on thesource
. Checking against typing.Mapping would be more flexible, allowing, for example, a ChainMap to be used as the underlying source.The text was updated successfully, but these errors were encountered: