On Apr 5, 2010, at 8:17 PM, Haoyu Bai wrote: > On Tue, Apr 6, 2010 at 4:25 AM, Stefan Behnel <[email protected]> > wrote: >> Robert Bradshaw, 05.04.2010 21:00: >>> On Apr 5, 2010, at 9:31 AM, Haoyu Bai wrote: >>>> Additionally, I think it is better to have >>>> something like a CythonModule.py as a counterpart of the Shadow.py, >>>> then it is easy to assure the content of the 'cython' module is the >>>> same between Cython and pure Python mode. >>> >>> I'm not convinced that grouping internal Cython constructions >>> based on >>> whether they have a "pure" counterpart is the best way to do >>> things-- >>> in my ind the directives having to do with division are best handled >>> in the division node, those dealing with buffers best handled in the >>> buffer code, etc. >> >> +1 >> >> It's nice to have a simple language interface to all these >> features, but >> that doesn't mean they have to be any similar on the implementation >> side. > > I'm not mean to unify the implementation of these features. The > decorators would just set directive or flags to the node, then the > nodes only need to dealing with these directives or flags, rather than > check the decorators directly.
This sounds very much like what the InterpretCompilerDirectives visitor does. it also unifies the various ways of setting directives (decorators are only one option). >>> I think it's much safer to simply forbid "from cython import *", >>> especially as its contents may change with time. >> >> +1 >> >> I'm even fine with forbidding reassignments to names imported from >> the >> cython namespace. The cython module is special in every way, so >> making it >> just a bit more special so that we can simplify the compiler sounds >> reasonable to me. Sounds reasonable to me. >> I can't imagine any use case for any of the above >> examples. When we find them in code, it's almost certainly a bug that >> Cython should bark at. > > Agree with forbidding reassignments. But if we forbid "from cython > import *", then do we allow this: > > from cython import cfunc, int, float > > otherwise, I just imagine, it could be pain to write a lot of > @cython.cfunc instead of the simply cdef. Yes, for sure we will (and currently do) allow named imports, even "from cython import long as my_long." - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
