On Friday, February 12, 2016 at 1:21:26 PM UTC-8, kcrisman wrote: > > See > http://stackoverflow.com/questions/35305027/cant-import-sage-file-in-same-directory/ > I feel like there must be an improvement on my answer, hopefully someone > can elaborate on how to do that there. >
I think an important thing to point out is that while ".sage" files aren't modules, there is still a way of ensuring one is read from another, by "load". Indeed, it is not a replacement of modules and it doesn't provide the advantages (or drawbacks!) of namespaces. Furthermore, I think it's a fairly deliberate design decision that there is currently not a way to apply the preparser for loading *modules*. It means that sage stays close to being a python library. The preparser really only is for casual interactive use, just as the override of certain functions in the interactive global namespace is only for casual interactive use (and actually harmful for more serious programming). The good thing of course is that (as Dima points out), there is a way to compile to a .py file. Especially in Python3 there is a lot you can do to customize the "import" machinery. It would probably be possible to configure it so that it recognizes .sage files. But I think it is fairly deliberate that no efforts in that direction have been undertaken. -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.