66 < div >
77 < h1 >
88 < img width ="277 " height ="86 " id ="_x0000_i1025 " align ="center "
9- src ="../../../c++boost.gif " alt = "c++boost.gif (8819 bytes) "> Comparisons with
9+ src ="../../../c++boost.gif " alt = "c++boost.gif (8819 bytes) "> < br >
10+ Comparisons with
1011 Other Systems
1112 </ h1 >
1213
1314 < h2 > CXX</ h2 >
1415 < p >
15- Like BPL , < a href ="http://cxx.sourceforge.net/ "> CXX</ a > attempts to
16+ Like Boost.Python , < a href ="http://cxx.sourceforge.net/ "> CXX</ a > attempts to
1617 provide a C++-oriented interface to Python. In most cases, as with the
1718 boost library, it relieves the user from worrying about
1819 reference-counts. Both libraries automatically convert thrown C++
@@ -40,9 +41,15 @@ <h2>CXX</h2>
4041 < p >
4142 As far as I can tell, CXX enables one to write what is essentially
4243 idiomatic Python code in C++, manipulating Python objects through the
43- same fully-generic interfaces we use in Python. While you're hardly programming directly to the ``bare
44- metal'' with CXX, it basically presents a ``C++-ized''
45- version of the Python 'C' API.
44+ same fully-generic interfaces we use in Python. While you're hardly
45+ programming directly to the ``bare metal'' with CXX, it basically
46+ presents a ``C++-ized'' version of the Python 'C' API. Some fraction of
47+ that capability is available in Boost.Python through < tt > < a
48+ href ="../../../boost/python/objects.hpp "> boost/python/objects.hpp</ a > </ tt > ,
49+ which provides C++ objects corresponding to Python lists, tuples,
50+ strings, and dictionaries, and through < tt > < a
51+ href ="../../../boost/python/callback.hpp "> boost/python/callback.hpp</ a > </ tt > ,
52+ which allows you to call back into python with C++ arguments.
4653
4754 < p >
4855 < a href ="mailto:dubois1@llnl.gov "> Paul F. Dubois</ a > , the original
@@ -65,7 +72,7 @@ <h2>SWIG</h2>
6572 languages. Swig relies on a parser to read your source code and produce
6673 additional source code files which can be compiled into a Python (or
6774 Perl or Tcl) extension module. It has been successfully used to create
68- many Python extension modules. Like BPL , SWIG is trying to allow an
75+ many Python extension modules. Like Boost.Python , SWIG is trying to allow an
6976 existing interface to be wrapped with little or no change to the
7077 existing code. The documentation says ``SWIG parses a form of ANSI C
7178 syntax that has been extended with a number of special directives. As a
@@ -78,15 +85,15 @@ <h2>SWIG</h2>
7885 couldnt handle templates, didnt do func overloading properly etc. For
7986 ANSI C libraries this was fine. But for usual C++ code this was a
8087 problem. Simple things work. But for anything very complicated (or
81- realistic), one had to write code by hand. I believe BPL doesn't have
88+ realistic), one had to write code by hand. I believe Boost.Python doesn't have
8289 this problem[< a href ="#sic "> sic</ a > ]... IMHO overloaded functions are very important to
8390 wrap correctly.''< br > < i > -Prabhu Ramachandran</ i >
8491 </ blockquote >
8592
8693 < p >
87- By contrast, BPL doesn't attempt to parse C++ - the problem is simply
94+ By contrast, Boost.Python doesn't attempt to parse C++ - the problem is simply
8895 too complex to do correctly. < a name ="sic "> Technically</ a > , one does
89- write code by hand to use BPL . The goal, however, has been to make
96+ write code by hand to use Boost.Python . The goal, however, has been to make
9097 that code nearly as simple as listing the names of the classes and
9198 member functions you want to expose in Python.
9299
@@ -95,7 +102,7 @@ <h2>SIP</h2>
95102 < a
96103 href ="http://www.thekompany.com/projects/pykde/background.php3?dhtml_ok=1 "> SIP</ a >
97104 is a system similar to SWIG, though seemingly more
98- C++-oriented. The author says that like BPL , SIP supports overriding
105+ C++-oriented. The author says that like Boost.Python , SIP supports overriding
99106 extension class member functions in Python subclasses. It appears to
100107 have been designed specifically to directly support some features of
101108 PyQt/PyKDE, which is its primary client. Documentation is almost
@@ -113,7 +120,7 @@ <h2>ILU</h2>
113120 to a wide range of computer languages, including Common Lisp, C++, C,
114121 Modula-3, and Python. ILU can parse the ISL to generate a C++ language
115122 header file describing the interface, of which the user is expected to
116- provide an implementation. Unlike BPL , this means that the system
123+ provide an implementation. Unlike Boost.Python , this means that the system
117124 imposes implementation details on your C++ code at the deepest level. It
118125 is worth noting that some of the C++ names generated by ILU are supposed
119126 to be reserved to the C++ implementation. It is unclear from the
@@ -148,7 +155,7 @@ <h2>GRAD</h2>
148155 < h2 > Zope ExtensionClasses</ h2 >
149156 < p >
150157 < a href ="http:http://www.digicool.com/releases/ExtensionClass ">
151- ExtensionClasses in Zope</ a > use the same underlying mechanism as BPL
158+ ExtensionClasses in Zope</ a > use the same underlying mechanism as Boost.Python
152159 to support subclassing of extension types in Python, including
153160 multiple-inheritance. Both systems support pickling/unpickling of
154161 extension class instances in very similar ways. Both systems rely on the
@@ -158,31 +165,35 @@ <h2>Zope ExtensionClasses</h2>
158165 < p >
159166 The major differences are:
160167 < ul >
168+ < li > Zope is entirely 'C' language-based. It doesn't require a C++
169+ compiler, so it's much more portable than Boost.Python, which stresses
170+ the limits of even some modern C++ implementations.
171+
161172 < li >
162- BPL lifts the burden on the user to parse and convert function
173+ Boost.Python lifts the burden on the user to parse and convert function
163174 argument types. Zope provides no such facility.
164175 < li >
165- BPL lifts the burden on the user to maintain Python
176+ Boost.Python lifts the burden on the user to maintain Python
166177 reference-counts.
167178 < li >
168- BPL supports function overloading; Zope does not.
179+ Boost.Python supports function overloading; Zope does not.
169180 < li >
170- BPL supplies a simple mechanism for exposing read-only and
181+ Boost.Python supplies a simple mechanism for exposing read-only and
171182 read/write access to data members of the wrapped C++ type as Python
172183 attributes.
173184 < li >
174185 Writing a Zope ExtensionClass is significantly more complex than
175- exposing a C++ class to python using BPL (mostly a summary of the
186+ exposing a C++ class to python using Boost.Python (mostly a summary of the
176187 previous 4 items). < a href =
177188 "http://www.digicool.com/releases/ExtensionClass/MultiMapping.html "> A
178189 Zope Example</ a > illustrates the differences.
179190 < li >
180191 Zope's ExtensionClasses are specifically motivated by ``the need for a
181- C-based persistence mechanism''. BPL 's are motivated by the desire
192+ C-based persistence mechanism''. Boost.Python 's are motivated by the desire
182193 to simply reflect a C++ API into Python with as little modification as
183194 possible.
184195 < li >
185- The following Zope restriction does not apply to BPL : ``At most one
196+ The following Zope restriction does not apply to Boost.Python : ``At most one
186197 base extension direct or indirect super class may define C data
187198 members. If an extension subclass inherits from multiple base
188199 extension classes, then all but one must be mix-in classes that
@@ -191,21 +202,21 @@ <h2>Zope ExtensionClasses</h2>
191202 Zope requires use of the somewhat funky inheritedAttribute (search for
192203 ``inheritedAttribute'' on < a
193204 href ="http://www.digicool.com/releases/ExtensionClass "> this page</ a > )
194- method to access base class methods. In BPL , base class methods can
205+ method to access base class methods. In Boost.Python , base class methods can
195206 be accessed in the usual way by writing
196207 ``< code > BaseClass.method</ code > ''.
197208 < li >
198209 Zope supplies some creative but esoteric idioms such as < a href =
199210 "http://www.digicool.com/releases/ExtensionClass/Acquisition.html ">
200- Acquisition</ a > . No specific support for this is built into BPL .
211+ Acquisition</ a > . No specific support for this is built into Boost.Python .
201212 < li >
202213 Zope's ComputedAttribute support is designed to be used from Python.
203214 < a href ="special.html#getter_setter "> The analogous feature of
204- BPL </ a > can be used from C++ or Python. The feature is arguably
205- easier to use in BPL .
215+ Boost.Python </ a > can be used from C++ or Python. The feature is arguably
216+ easier to use in Boost.Python .
206217 </ ul >
207218 < p >
208- Next: < a href ="example1.html "> A Simple Example Using BPL </ a >
219+ Next: < a href ="example1.html "> A Simple Example Using Boost.Python </ a >
209220 Previous: < a href ="extending.html "> A Brief Introduction to writing Python Extension Modules</ a >
210221 Up: < a href ="index.html "> Top</ a >
211222 < p >
@@ -215,6 +226,6 @@ <h2>Zope ExtensionClasses</h2>
215226 express or implied warranty, and with no claim as to its suitability
216227 for any purpose.
217228 < p >
218- Updated: Nov 26, 2000
229+ Updated: Mar 6, 2001
219230 </ div >
220231
0 commit comments