<div dir="ltr">On Mon, Sep 22, 2008 at 1:46 AM, Christian Heimes <span dir="ltr">&lt;<a href="mailto:lists@cheimes.de" target="_blank">lists@cheimes.de</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


Do you want to check for builtin types like PyString, PyUnicode etc. or<br>
subclasses? Python has super fast checks for builtin types, for example<br>
PyString_Check(obj) or PyString_CheckExact(obj).<br>
<br>
PyObject_TypeCheck is a macro while PyObject_IsInstance is a recursive<br>
function that does much more work than PyObject_TypeCheck. Therefore<br>
PyObject_TypeCheck should be a bit faster than PyObject_IsInstance. By<br>
the way the latter is invoked by isinstance(), too.<br>
<br>
Christian</blockquote><div>In most cases I&#39;m checking for whatever is generated by cdef class Foo: ... I&#39;m not sure if that would be a type or a subclass. There are a few places where I am do checks for dict, str, unicode, and list. I have absolutely no idea how that would affect things, though.<br>
<br>-Aaron<br>
</div></div></div>