[Python] How to distinguish between an instance of a class and normal datatype...

Discussão em 'Python' iniciado por Stack, Agosto 29, 2025.

  1. Stack

    Stack Membro Participativo

    In Python I am trying to integrate through an object wo (user defined) and wo.obj is another user defined object how do I tell it is an instance of a class rather than normal data types?

    type(wo.obj)
    <class '__main__.test'>

    type(wo.obj) is types.InstanceType
    False

    type(wo.obj) is types.ClassType
    False

    Continue reading...

Compartilhe esta Página