How to use collections.abc from both Python 3.8+ and Python 2.7

后端 未结 4 1820
执念已碎
执念已碎 2020-12-06 04:08

In Python 3.3 \"abstract base classes\" in collections (like MutableMapping or MutableSequence) were moved to second-level module

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-06 04:27

    Looks like fresh version of the six module have collections_abc alias, so you can use:

    from six.moves import collections_abc
    

提交回复
热议问题