Skip to content
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

Use isinstance check so library can be used for more types #1

Merged
merged 1 commit into from Dec 31, 2014

Conversation

svisser
Copy link
Contributor

@svisser svisser commented Dec 31, 2014

By using if isinstance(v, collections.Mapping) you can make this library work not just for dictionaries but also for the common dictionary types in the standard library (such as collections.OrderedDict) as well as subclasses made by the user:

>>> d = collections.OrderedDict()
>>> type(d) is dict
False
>>> isinstance(d, collections.Mapping)
True

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 63c0cd9 on svisser:patch-1 into ff9c7e3 on bfontaine:origin/master.

bfontaine added a commit that referenced this pull request Dec 31, 2014
Use isinstance check so library can be used for more types
@bfontaine bfontaine merged commit 86c9f11 into bfontaine:origin/master Dec 31, 2014
@bfontaine
Copy link
Owner

Merged, thanks!

bfontaine added a commit that referenced this pull request Dec 31, 2014
@svisser
Copy link
Contributor Author

svisser commented Dec 31, 2014

Thanks for merging. I have also written a section at https://github.com/svisser/python-improvements/blob/master/README.md with some more details.

Have a good 2015!

@svisser svisser deleted the patch-1 branch December 31, 2014 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants