What is the difference between class Foo(): and class Date(object):

Veek M vek.m1234 at gmail.com
Mon Nov 21 07:15:12 EST 2016


>>> class Foo():
...  pass
... 
>>> class Bar(Foo):
...  pass
... 
>>> b = Bar()
>>> type(b)
<type 'instance'>

>>> class Date(object):
...  pass
... 
>>> class EuroDate(Date):
...  pass
... 
>>> x = EuroDate()
>>> type(x)
<class '__main__.EuroDate'>


What is going on here? Shouldn't x = EuroDate();  type(x) give 
'instance'?? Why is 'b' an 'instance' and 'x' EuroDate?
Why isn't 'b' Bar?

----
Guhh! (I am reading @classmethods from beazley - i know i have two open 
threads but I'll get to that - will require even more reading)





More information about the Python-list mailing list