Stefan Behnel wrote: > Dag Sverre Seljebotn wrote: >> Stefan Behnel wrote: >>> Dag Sverre Seljebotn wrote: >>>> a) Auto-cimport (if a directive is set, which defaults to on?). I.e. if >>>> you do a Python import, and a pxd file can be found, a cimport is done >>>> automatically. >>> +0.7 given that this may really have a performance impact, as Robert >>> stated. There should at least be a cache for the standard include path that >>> survives multiple compilations in one compiler run (another orthogonal >>> feature that would be nice for .pxd files in general). >> with cython.nopxd: >> import mymodule >> >> ? > > -1 > > Besides being the wrong way round (most Python modules do not have a .pxd > file), this is clearly something that Cython should handle behind the > scenes. User code shouldn't be impacted by it. If anything, a compiler > option would fit. But thinking about that now smells like a premature > optimisation to me.
But (expert) users must have control and care about this, it cannot happen behind the scenes anyway! I.e. with no automatic cimport, you can do import itertools ... itertools = None ... With auto cimport (like you seemed to want originally, at least for the specific case of itertools) this is a syntax error. This early-binding is the big change in semantics; everything else is just details. But I think it makes sense to say that Cython does, for module-level imports at the top of the file, early bind them, as it is OK anyway for 99% of the usecases (and a syntax error is raised anyway at "itertool = None", which could say "you have to turn off auto-cimport"). -- Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
