PyObject obj = new PyDictionary(); PyType dictType = obj.getType(); if (PyType.lookup(dictType.getName()).isSubType(PyType.DictType)) { System.out.println("obj is a dictionary."); }
PyObject obj = new PyFunction(); PyType funcType = obj.getType(); if (PyType.lookup(funcType.getName()).isCallable()) { System.out.println("obj is callable."); }These examples demonstrate the use of the `lookup` method of the `PyType` class to look up the PyType by name and use the PyType methods to check its properties. The package library that contains the `org.python.core.PyType` class is the Jython library, which is a Java implementation of the Python programming language. It allows Java programs to interact with Python objects and modules.