[Python-Dev] Feature request: better support for "wrapper" objects

M.-A. Lemburg mal@lemburg.com
Wed, 09 Jan 2002 19:42:11 +0100


Jack Jansen wrote:
> 
> Recently, "M.-A. Lemburg" <mal@lemburg.com> said:
> > Sounds like you want to introduce a "buffer" interface for these
> > objects.
> 
> No, that is something completely different. I want a replacement for
> PyArg_Parse("O&", funcptr, void**) that has the form
> PyArg_Parse("O@", typeobject, void**) and similarly for Py_BuildValue.
> 
> Because the typeobject has a Python representation (whereas the
> function pointer does not) this would allow modules like struct and
> calldll to support objects that have this interface, because these
> modules are driven from specifications in Python. There is currently
> no way to get from the typeobject to the function pointer needed for
> O&.

If I'm not mistaken this looks like an interface which resembles
the copyreg registry where you ask an object for a way to
pickle itself and a way to restore itself from the pickle.
(I think one of the ways pickle supports this more directly
is by looking for a reduce method.)

That would be nice to have indeed. For the simple objects you
have in mind, the void* could be wrapped into a PyCObject, BTW.

Could you write this up as a short PEP ?

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                   http://www.egenix.com/files/python/