-
-
Save stephengruppetta/149c3b9e93be2d367af701d99c0bb20e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import collections | |
# A tuple is iterable | |
print(isinstance((2, 4, 6), collections.abc.Iterable)) | |
# True | |
# A dictionary is a mapping | |
print(isinstance({"Jim": 10, "Chris": 12}, collections.abc.Mapping)) | |
# True | |
# But a dictionary is not a sequence | |
print(isinstance({"Jim": 10, "Chris": 12}, collections.abc.Sequence)) | |
# False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment