Helping ordinary people create extraordinary websites!
GET OUR NEWSLETTER
Your Email:
 

Extending Python and Zope in C

By Michael Roberts
2004-12-04


The Best of Both Worlds

Extending Python in C is easy once you see how it all works, and an extension of Python is equally easy to package up for Zope. The hard part is wading through the different documentation sets in search of the nuggets of information you need, and Michael has collected them for you in this article.

You might want to extend Zope in C for several reasons. The most likely is that you have an existing C library that already does something you need, and you're not excited about translating it to Python. Also, since Python is an interpreted language, any Python code that gets called a lot is going to slow you down. So even if you have some extension you've written in Python, you may still want to consider moving the most often called parts into C. Either way, extending Zope starts with extending Python. Furthermore, extending Python gets you other nice benefits because your code is accessible from any Python script, not just Zope. The only caveat here is that although Python's current version is 2.1 as of this writing, Zope still runs only with Python 1.5.2. For C extensions, there are no changes between the two versions, but if you get fancy with the Python wrappings for your library, you need to be careful not to use anything that's newer than 1.5.2 if you want it all to work under Zope.


Tutorial Pages:
» The Best of Both Worlds
» Extending Python for Fun and Profit
» Writing the Code
» Building the Extension
» Taking it to Zope
» Creating an External Method
» Zope scripts: Cliff Notes version
» Going all out With a Product
» Where to go From Here
» Resources


First published by IBM DeveloperWorks


 | Bookmark
Related Tutorials:
» Python and Java - A Side by Side Comparison
» Learn Python in 10 Minutes
» Python 201 - (Slightly) Advanced Python Topics
» Python 101 - Introduction to Python
» Google Sitemaps
» Python 101

Advertise with Us!


Tutorials Scripts Web Hosting Developer Manuals
Resources