Issue
Is Python's OrderedDict
data structure a mutable collection?
The documentation does not say anything about it, and after a quick search on the web, I have not found any answer yet.
Solution
The documentation does not say anything about it, and after a quick search on the web, I have not found any answer yet.
When in doubt regarding mutability of class you might run following test
from collections import OrderedDict
from collections.abc import MutableSequence, MutableSet, MutableMapping
print(issubclass(OrderedDict,(MutableSequence,MutableSet,MutableMapping)))
output
True
See Collections Abstract Base Classes in collections.abc
docs for other things which can be checked this way.
Answered By - Daweo
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.