Aug-20-2021, 05:56 AM
(Aug-17-2021, 07:17 PM)quazirfan Wrote: [ -> ]I come from Java background where every class implicitly inherits from object class. I was under the assumption it is the same with python.Actually, you are right - everything inherits from object, at least in python3 (in python2 there were old-style or classical class and new-style class).
You can see with
isinstance
>>> type(type) <class 'type'> >>> isinstance(type, object) True >>> isinstance(str, object) True >>> isinstance(type, type) True >>> isinstance(str, type) True >>> type.__bases__ (<class 'object'>,) >>> str.__bases__ (<class 'object'>,)