Stefan Behnel wrote: > Greg Ewing wrote: >> 2) To get Python semantics for / and %, put this at >> the top of the module: >> >> from __python__ import idiv, imod >> >> 3) You are allowed to feed a ".py" file directly to >> Cython, in which case it is compiled as though it >> begins with an implicit >> >> from __python__ import * > > I thought about 3), too. If provided together with 2) it might be ok. > Otherwise, it would mean that we break programs simply by letting users > rename the file (e.g. because they want to start using "cdef" syntax). Such > differences between .py file compilation and .pyx file compilation should > be documented somewhere.
It means "one more thing to consider" though. E.g. to know what "//" does one needs to know not only the types it is operating on and which imports are used, but possibly whether one is compiling a .pyx or .py. I'm -1 on this, and +1 on always defining .py compilation in Cython as a strict subset of .pyx compilation (exception: Making e.g. "cdef" a valid variable name in .py files). Much easier to explain and remember. -- Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
