how to tell if x is an instance of new class?

Discussion in 'Python' started by Michal Vitecek, Aug 19, 2004.

  1. hello,

    i'm (once again) fighting with python C API. i'm simply unable to
    determine whether 'x' is an instance of new class or not.

    result of PyObject_Type(x) is unusable, PyType_Check(x) returns 0,
    PyType_IsSubtype(x->ob_type, &PyType_Type) returns 0,
    PyType_IsSubtype((PyTypeObject *)x, &PyType_Type) returns 0...

    how come there's no *easy-and-immediately-obvious* way to get such an
    important information? what am i missing?

    HELP!
    --
    fuf ()
    Michal Vitecek, Aug 19, 2004
    #1
    1. Advertising

  2. Michal Vitecek <> writes:

    > hello,
    >
    > i'm (once again) fighting with python C API. i'm simply unable to
    > determine whether 'x' is an instance of new class or not.


    The problem is that this question isn't terribly wll defined. Why do
    you want to know?

    Cheers,
    mwh

    --
    The ultimate laziness is not using Perl. That saves you so much
    work you wouldn't believe it if you had never tried it.
    -- Erik Naggum, comp.lang.lisp
    Michael Hudson, Aug 23, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sridhar R
    Replies:
    14
    Views:
    1,379
    =?iso-8859-1?Q?Fran=E7ois?= Pinard
    Feb 10, 2004
  2. Michal Vitecek
    Replies:
    0
    Views:
    249
    Michal Vitecek
    Jan 28, 2004
  3. yogesh
    Replies:
    1
    Views:
    353
    Victor Bazarov
    Mar 14, 2007
  4. Martin P. Hellwig
    Replies:
    1
    Views:
    361
    Martin P. Hellwig
    Mar 26, 2010
  5. Replies:
    3
    Views:
    104
Loading...

Share This Page