list vs UserList and dict vs UserDict

前端 未结 2 1848
野性不改
野性不改 2021-01-04 09:18

Coding this day, which of the above is preferred and recommended (both in Python 2 and 3) for subclassing?

I read that UserList and UserDict

2条回答
  •  半阙折子戏
    2021-01-04 09:50

    No they are not encouraged anymore. You should not use the UserDict class as it is deprecated. The docs says you can just subclass dict directly. The userdict module is gone in Python 3.0

提交回复
热议问题