Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-10-14 18:23:15

It's different. How entirely different? I'm not sure ;-) Looking at, these are the obvious

* Both rely on the same "Don Beaudry Hack" that also inspired MESS.
* Both support subclassing in Python, including multiple inheritance

and the differences:

* py_cpp lifts the burden on the user to parse and convert function argument
types. Zope provides no such facility.
* py_cpp lifts the burden on the user to maintain Python reference-counts.
* py_cpp supports function overloading; Zope does not.
* py_cpp supplies a simple mechanism for exposing read-only and read/write
access to data members of the wrapped C++ type as Python attributes.
* Writing a Zope ExtensionClass is significantly more complex than exposing
a C++ class to python using py_cpp (mostly a summary of the previous 4
items). See for a Zope
* Zope's ExtensionClasses are specifically motivated by "the need for a
C-based persistence mechanism". py_cpp's are not.
* Thus, Zope's ExtensionClasses support pickling. Currently py_cpp
ExtensionClasses do not.
* The following Zope restriction does not apply to py_cpp: "At most one base
extension direct or indirect super class may define C data members. If an
extension subclass inherits from multiple base extension classes, then all
but one must be mix-in classes that provide extension methods but no data"
* Zope's Extension SubClasses admit multiple-inheritance from both Zope
ExtensionClasses /and/ Python classes. This capability is currently not
available in py_cpp.
* Zope supplies the standard special Python class attributes __doc__,
__name__, __bases__, __dict__, and __module__ on it's ExtensionClasses;
py_cpp does not (coming soon ;->)
* Zope supplies some creative but esoteric idioms such as Acquisition
* Zope's ComputedAttribute support is designed to be used from Python. The
analogous feature of py_cp is designed to be used from C++ (I make no claims
that the py_cpp mechanism is more useful than the Zope mechanism in this

Also, the Zope docs say:
"The first superclass listed in the class statement defining an extension
subclass must be either a base extension class or an extension subclass.
This restriction will be removed in Python-1.5." I believe that this promise
was made prematurely. I have looked at the Python 1.5.2 source code and I
don't believe it is possible to deliver on it.

Thanks for the opportunity to write this. I'm currently overhauling the
py_cpp documentation; this will make a valuable addition.

 ----- Original Message -----
From: "Mark Evans" <mark.evans_at_[hidden]>
To: <abrahams_at_[hidden]>
Sent: Saturday, October 14, 2000 5:24 PM
Subject: Who is py_cpp

> Is py_cpp the same thing as the ExtensionClass system used in
> ZOPE? Or something entirely different?
> Kind regards,
> Mark Evans
> mailto:mark.evans_at_[hidden]

Boost list run by bdawes at, gregod at, cpdaniel at, john at