[Numpy-discussion] Fast threading solution thoughts
Gael Varoquaux
gael.varoquaux at normalesup.org
Thu Feb 12 11:24:27 EST 2009
On Thu, Feb 12, 2009 at 03:27:51PM +0100, Sturla Molden wrote:
> The question is: Should OpenMP be comments in the Cython code (as they
> are in C and Fortran), or should OpenMP be special objects?
My two cents: go for cython objects/statements. Not only does code in
comments looks weird and a hack, but also it means to you have to hack
the parser. Finally cython can be used in a valid Python syntax (at least
part of it) thanks to decorators giving the types. Ondrej Certik
implemented to for sympy. Having pragmas in comments would make it hard
to use the vanilla Python parser to read this code, or to do
metaprogramming on the pragmas.
The logic of Python is pretty much that everything is accessible to the
programmer, to be modified, eg for testing. Putting logics in comments
breaks this.
I like the use of the with statement for this purpose.
Gaël
More information about the NumPy-Discussion
mailing list