Pyrex


Version: 0.9.8.5
Category:
Scripts
Python
Requirements:
Seller:
Price:
-
System:
Rating:
4.5
License:

Description - Pyrex



Pyrex is a language specially designed for writing Python extension modules. It`s designed to bridge the gap Between the nice, high-level, easy-to-use world of Python and the messy, low-level world of C. You may be wondering why anyone would want a special language for this. Python is really easy to extend using C or C++, isn`t it? Why not just write your extension modules in one of those languages? Well, if you`ve ever written an extension module for Python, you`ll know that things are not as easy as all that. First of all, there is a fair bit of boilerplate code to write before you can even get off the ground. Then you`re faced with the problem of converting between Python and C data types. For the basic types such as numbers and strings this is not too bad, but anything more elaborate and you`re into picking Python objects apart using the Python/C API calls, which requires you to be meticulous about maintaining reference counts, checking for errors at every step and cleaning up properly if anything goes wrong. Any mistakes and you have a nasty crash that`s very difficult to debug. Various tools have been developed to ease some of the burdens of producing extension code, of which perhaps SWIG is the best known. SWIG takes a definition file consisting of a mixture of C code and specialised declarations, and produces an extension module. It writes all the boilerplate for you, and in many cases you can use it without knowing about the Python/C API. But you need to use API calls if any substantial restructuring of the data is required between Python and C.



More in Python-Pyrex

Pyrex Pyrex Extension Module Meticulous About Maintaining