Python C api: create a new object class
Benjamin Peterson
benjamin at python.org
Tue Nov 10 17:20:15 EST 2009
lallous <lallous <at> lgwm.org> writes:
> Is there is a one line syntax to instantiate an instance?
You can't instantiate an instance; it's already instantiated.
>
> Any other ways than this:
> o = new.classobj('object', (), {})
class x: pass
> How can I, similarly, create an object "o" in C api:
Use PyObject_CallFunction(PyType_Type, [arguments])
> Given a PyObject* is there is a way to tell if one can call
> PyObject_SetAttrString() on that object w/o getting an error?
No.
More information about the Python-list
mailing list