type and object

Chris Angelico rosuav at gmail.com
Thu Oct 5 13:04:28 EDT 2017


On Fri, Oct 6, 2017 at 3:17 AM, Naveen Yadav <navyad.pro at gmail.com> wrote:
> Hi folks,
>
>
>>> isinstance(type, object) is True   # 1
> and
>>> isinstance(object, type) is True   # 2
>
>
> its means type is object is type, But i am not sure how is this.
>
> For what i can understand is
> for #1: since every thing is object in python, type is also an object.
> and
> for #2: object is a base type. therefore object is type
>>> object.__doc__
>>> 'The most base type'
>
>
> Am I understanding this correct ? Please shed light on this.

Yep :) Everything's an object, everything has a type, every type has
an object. The hierarchy has a little loop in it at the top.

ChrisA



More information about the Python-list mailing list