class inheritance when not defined

Thomas Jollans tjol at tjol.eu
Fri Sep 8 04:47:54 EDT 2017


On 2017-09-08 10:17, Andrej Viktorovich wrote:
> Hello
> 
> I found several class creation samples:
> 
> class ExampleClass1:
> 
> class ExampleClass2(object):
> 
> 
> What is difference between them? Who is the father of ExampleClass1 ?
> 


In Python 3, unless you've redefined "object", these are the same.

Python 2 had, for historical reasons, a distinction between "old-style"
and "new-style" classes. It normally doesn't matter much, but explicitly
inheriting from object makes a class new-style.


-- 
Thomas Jollans



More information about the Python-list mailing list