1)Why we need to call class from Object ?
Can you provide some good example where calling from object is necessary . I found below one but not getting it. In Python 2.7 x this should look like below
class Foo:
pass
class Bar(Foo):
pass
2) I found that , in Python 3.x there is no need to derive explicitly from object ? What does this mean ? Does this mean we don't need to call class Bar(Foo) ? Hard to understand as a newbie. Please explain .
3) In Python 2.7
class Boat():
pass
my_boat = Boat() #instantiate object
my_boat2 = Boat() #instantiate object
print(my_boat)
print(my_boat2)
<main.Boat instance at 0x0000000008DFEC88>
<main.Boat instance at 0x0000000008DFECC8>
Running the same code in Python 3.x gives me
<main.Boat object at 0x000002406FF8E390>
<main.Boat object at 0x000002406FF8ECF8>
a) So Can I conclude that instance and Object are same in Python 3.x ? Although after going through many readings from different sources I understand that
Instance is just a blueprint of Class.
Class is also an Object . When we instantiate a class it's an object.
Everything in Python is an Object
Correct me in case my understanding is wrong. So following the above understanding it is quite hard to understand why Object and instance are the same thing. Please clear me on this .