Re: PyCheck for a classes defined in python and user data in PyObject_HEAD



On Nov 1, 4:14 pm, snd...@xxxxxxxxx wrote:
q#1:
in C I want to check if a given PyObject is a xml.dom.minidom.Node (or
a derivative).
how do i extract a PyTypeObject for such a class?

nevermind, i found an instance object that will work for me
as long as i figure out where is the documentation
beyond this:
http://docs.python.org/api/instanceObjects.html
on the data attrib access and extracting PyClassObject from it.


issue #2
I'm in a situation when i don't really need to extend python with any
classes of my own but
i do have extra luggage for the python data structures such as tuples,
lists, dictionaries, etc
on the c++ side. I see no place in PyObject_HEAD where i can stick a
void* to my extra data.
If i enter a feature request into bugzilla for python do you think it
will be well received?
#ifdefed of course like the prev/next extras.
I'm surprised noone else is using evil twin approach.
The reason i'm asking is because while for dictionaries i can stick
weak pointer back to my c++
object in a key with an obscure name while in lists this would change
the list size and thus
is obviously not as easy to "hide" from the client code.
a placeholder in a pyobject would've been of help here


.



Relevant Pages

  • PyCheck for a classes defined in python and user data in PyObject_HEAD
    ... in C I want to check if a given PyObject is a xml.dom.minidom.Node (or ... I'm in a situation when i don't really need to extend python with any ... The reason i'm asking is because while for dictionaries i can stick ... object in a key with an obscure name while in lists this would change ...
    (comp.lang.python)
  • Re: embedding python: simulating sequence get item / set item methods
    ... > when embedding python: how can I create a type which simulates item ... > void setter(PyObject* self, int i, PyObject new_value) ... > and I'd like the first method called if: ... a look in the Python sources at the way the type objects for lists &c ...
    (comp.lang.python)
  • Re: is there a better way?
    ... You have a list of unknown length, ... You want to extract all and only the X's. ... involves Python, things might slow down a bit... ... Osolution for big lists. ...
    (comp.lang.python)
  • Re: Official definition of call-by-value (Re: Finding the instance reference...)
    ... I cannot say what defines a Python object in a generic way, but I do know what defines a CPython object. ... Most functions in the CPython API receive, return, or handle PyObject pointers everywhere. ... The PyObject struct is very small and contains nothing apart from the ob_type field. ... We refer to this dictionary as the '__dict__' attribute in Python code, but it is just another field in the object struct, as anything else. ...
    (comp.lang.python)
  • Re: Re: maximum value in a column of file
    ... I was trying to do this by using python, that the reason why i tried to use numpy. ... extract value from line ... ...
    (comp.lang.python)