[Cython] help with function pointer
Stefan Behnel
stefan_ml at behnel.de
Tue Apr 21 13:16:31 CEST 2009
Jean-Francois Moulin wrote:
> As for the use of eval and the name of the class, it comes straight of
> my python version were I used to import a module which contained the
> class definition. So the code was self adapting in each
> new case...
Well, eval() is not a good idea even in Python, as it requires you to
convert the parameters to a string first and then parse them again, which
may break things if they cannot be property escaped (see "SQL injection" &
friends).
> The idea was that this part of the code, which is a low-level reader
> for some binary file could be changed to accomodate different vendor
> versions or types of input files.
> Maybe that is a stupid way of doing...
> So stupid question now...: can I use a pointer to a class?
Sure, a class is a Python object. Just do what you'd do in Python: pass
the object and call it.
Stefan
More information about the Cython-dev
mailing list