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

前端 未结 4 584
余生分开走
余生分开走 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:58

    Referring to this The object in class Foo(object) is meant to make your python 3 code compatible with python 2 and 3.

提交回复
热议问题