As mentioned in a couple of previous emails, I've been experimenting  
with pure mode lately, with the main motivation being the use of  
development tools (coverage, lint etc.). I'm sure I can get that to  
work, but I also sort of like the plain Cython syntax :-) So an  
alternative occurred to me: Building plain Python from Cython.

IOW, I could just strip down the Cython code to get plain Python  
equivalents that I could use the dev-tools on. Is that just a silly  
idea? Would I be better off with pure mode? (Is there, perhaps, such a  
beast/processor somewhere? I'm assuming I could reuse the Cython  
parser if I needed to write something myself?)

I guess this might be useful also if people have already written  
Cython code that they'd like to have in plain Python form (although  
much, if not most, Cython code probably includes wrapping stuff that's  
not easy to translate... I mainly use it to implement algorithms for  
experiments).

 From the other perspective, if I'm going to go for pure mode, I'd  
appreciate being able to keep the Python files to be compiled as  
simple as possible (i.e., with as little explicit declarations as  
possible). I'm guessing that associated pxd files, along with CEP 505  
could make that possible, if I code carefully. How likely do you think  
it is that that CEP (or some equivalent) will be accepted? (I'm  
guessing it would be hard to make that handle Cython/numpy arrays,  
though...?)

And another thought/idea: What about allowing further declarations in  
the .pxd file (or some similar mechanism)? I.e., declaring local  
variables? Might seem pointless, but the idea would be to allow the  
compilation of optimized C from a plain Python file without any signs  
of Cython declaration. (This could then even be done with Python code  
you're not allowed to modifo.) I.e, you could specify all metadata  
separately. (If CEP 505 were accepted, this would only be needed in a  
few cases, I guess. Maybe?)

Sorry for rambling :-)

- M

-- 
Magnus Lie Hetland
http://hetland.org


_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to