473,320 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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 (fu*@mageo.cz)
Jul 18 '05 #1
1 1649
Michal Vitecek <fu*@mageo.cz> 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
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
4
by: | last post by:
Hi I have a list containing several instance address, for example: I'd like to invoke a method on each of these instance but I don't know : 1. if its possible 2. how to proceed
18
by: John M. Gabriele | last post by:
I've done some C++ and Java in the past, and have recently learned a fair amount of Python. One thing I still really don't get though is the difference between class methods and instance methods. I...
19
by: Mark Rance | last post by:
Consider this: typedef struct { char a; char b; char c; } foo; Why can I not execute a statement like:
3
by: Greg | last post by:
I have a form that is created if it is not already created. The code goes something like this: if (MyForm == null) MyForm = new MyForm(); else MyForm.Activate The problem is that if the...
9
by: Tony Maresca | last post by:
My class: class foo { protected virtual void MyMember() { } } When this class is a base with any number of derivatives,
2
by: stktung | last post by:
Hey guys, Are there functions in reflection that gives information about the base classes of an object? Thanks in advance -Steve
12
by: titan nyquist | last post by:
I have a class with data and methods that use it. Everything is contained perfectly THE PROBLEM: A separate thread has to call a method in the current instantiation of this class. There is...
1
by: Samuel R. Neff | last post by:
I'm looping through assemblies and checking CodeBase prior to processing a given assembly. However, I occasionally get this error: The invoked member is not supported in a dynamic module. ...
45
by: =?Utf-8?B?QmV0aA==?= | last post by:
Hello. I'm trying to find another way to share an instance of an object with other classes. I started by passing the instance to the other class's constructor, like this: Friend Class...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.