< BACKMake Note | BookmarkCONTINUE >
156135250194107072078175030179198180025031194137176049106218111004226051068056170216148170

Exercises

Extending Python. What are some of the advantages of Python extensions?

Extending Python. Can you see any disadvantages or dangers from using extensions?

Writing Extensions. Obtain or find a C/C++ compiler and write a small program with it to (re)familiarize yourself with C/C++ programming. Find your Python distribution directory and locate the Misc/Makefile.pre.in file. Take the program you just wrote and wrap it in Python. Go through the steps necessary to create a shared object. Access that module from Python and test it.

Porting from Python to C. Take several of the exercises you did in earlier chapters and port them to C/C++ as extension modules.

Wrapping C Code. Find a piece of C/C++ code which you may have done a long time ago, but want to port to Python. Instead of porting, make it an extension module.

Writing Extensions. In Exercise 13-3, you created a dollarize() function as part of a class to convert a floating point value to a financial numeric string with embedded dollar signs and commas. Create an extension featuring a wrapped dollarize() function and integrate a regression testing function, i.e., test(), into the module.

Extending vs. Embedding. What is the difference between extending and embedding?


Last updated on 9/14/2001
Core Python Programming, © 2002 Prentice Hall PTR

< BACKMake Note | BookmarkCONTINUE >

© 2002, O'Reilly & Associates, Inc.