Difference between class foo and class foo(object) in Python

前端 未结 4 585
余生分开走
余生分开走 2020-12-13 08:15

I know class foo(object) is an old school way of defining a class. But I would like to understand in more detail the difference between these two.

4条回答
  •  遥遥无期
    2020-12-13 08:50

    class foo(object): is the 'new' way of declaring classes.

    This change was made in python 2.2, see this PEP for an explanation of the differences.

提交回复
热议问题