Dag Sverre Seljebotn wrote: > 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.
My thoughts, too, and a reason to stick as close to Python semantics as it seems sensible. My only concern by now is that we might break existing code that already depends on C semantics here. (although one might argue that there is only a constant amount of existing code and an infinite amount of unwritten code ;) I think this topic merits a CEP by now. There are good arguments on both sides, and the decision should be documented. Stefan _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
