perhaps i'm being silly: i'm assuming that it is possible to preparse
right after 'import' has located the file, and still before it
actually does import it ! this would require modifying python, a bit
of a pain!

On 17 oct, 11:23, Pierre <[EMAIL PROTECTED]> wrote:
> my suggestion is that the standard extension should not be .sage, but
> rather .sage.py so import foo.sage would import foo.sage.py. It will
> also help python IDEs (thanks for the emacs tweak btw). And i believe
> it is true to sage's nature.
>
> Then, import should preparse if the extension is .sage.py, not if it
> is just .py.
>
> what do you think ?
>
> On 17 oct, 11:14, "William Stein" <[EMAIL PROTECTED]> wrote:
>
> > On 10/17/07, Pierre <[EMAIL PROTECTED]> wrote:
>
> > > I was wondering how to have my scripts preparsed: now i know. And i
> > > need to tell emacs that a .sage file needs to be treated like a .py
> > > file...
>
> > Put this in your .emacs file:
>
> > (setq auto-mode-alist (cons '("\\.sage\\'" . python-mode) auto-mode-alist))
>
> > > a problem with .sage files though is that the import command doesn't
> > > work with them (foo.sage is not found by either 'import foo' or
> > > 'import foo.sage'). I *know* there is the 'load' or the 'attach'
> > > command instead, but really i prefer import, because of what it does
> > > with namespaces: having 'foo.f()' is less likely to clash with f()...
> > > same with variables.
>
> > I understand.   It would indeed be god to have some sort of "preparse
> > then import" command.  Any suggestions for how it would work (i.e.,
> > from the user's point of view)?  Making
> >      import foo
> > work if foo.sage is there isn't really an option, since Python directly
> > does the import, and won't know to look for foo.sage.
>
> > William


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-forum
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to