[Pyrex] Question + 1new

Greg Ewing greg at cosc.canterbury.ac.nz
Fri Apr 18 04:00:56 CEST 2003


Riccardo Trocca <rtrocca at libero.it>:

> Just a question:
> doing so the RIMAGE_BGR24 is writable?

Yes.

> would it be possible to have an "ad hoc" way to export RO symbols
> from C?

That would be difficult. The module that exported Pyrex entities live
in is just an ordinary module object, so there's nothing to stop you
rebinding anything in it.  I suppose it would be possible to create
some special module-like object which had read-only attributes, but I
can't really see that it's worth it.

If you really *need* something to be read-only, define a function to
access it instead of making it a variable.

> Am I right? Exporting a function to Python is a two steps process?  Is
> it planned to add a "one step" approach in the future?  Anyway it
> should be easy to write some kind of preprocessor that automatically
> creates all the code in Pyrex.

It would be fairly straightforward to do *most* of this automatically,
but not all -- some things, such as preprocessor macros, defy
automatic conversion in general. A couple of people are working on
such tools, however, and something like this may be included with some
future release.

> I'm just thinking about SWIG where that can be easily done

I think you'll find it only works in SWIG for straightforward cases,
too. Pyrex is designed for handling all the NON-straightforward
cases where SWIG wimps out...

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+




More information about the Pyrex mailing list