Ask Your Question

Revision history [back]

This is perhaps not a satisfactory answer: when using attach, the fact that the file is preparsed or not depends on its name. If it ends with .sage then it will be preparsed, if it ends with .py then it will not be preparsed. It seems the preparsing is done before executing the files, so the preparser commands you write inside the files are useless.

So, if you want to use both preparsed and unpreparsed things within files, you should use a mix of files, some files ending with .py and some files ending with .sage.

Note that the preparsing is mainly a trick to make the interactive mode easier. If you aim at maintaining a set of files on the long term, it is advised to use only .py files, which are true Python. Note also that Sage source code is made of .py files and do not use any kind of preparsing. If you want to migrate old .sage files into .py files, you can use the preparse function to help in the translation.

This is perhaps not a satisfactory answer: when using attach, the fact that the file is preparsed or not depends on its name. If it ends with .sage then it will be preparsed, if it ends with .py then it will not be preparsed. It seems the preparsing is done before executing the files, so the preparser commands you write inside the files are useless.useless (the preparsing was already done when those lines are executed).

So, if you want to use both preparsed and unpreparsed things within files, you should use a mix of files, some files ending with .py and some files ending with .sage.

Note that the preparsing is mainly a trick to make the interactive mode easier. If you aim at maintaining a set of files on the long term, it is advised to use only .py files, which are true Python. Note also that Sage source code is made of .py files and do not use any kind of preparsing. If you want to migrate old .sage files into .py files, you can use the preparse function to help in the translation.

This is perhaps not a satisfactory answer: when using attach, the fact that the file is preparsed or not depends on its name. If it ends with .sage then it will be preparsed, if it ends with .py then it will not be preparsed. It seems the preparsing is done before executing the files, so the preparser commands you write inside the files are useless (the preparsing was already done when those lines are executed).

So, if you want to use both preparsed and unpreparsed things within files, you should use a mix of files, some files ending with .py and some files ending with .sage.

Note that the preparsing is mainly a trick to make the interactive mode easier. If you aim at maintaining a set of files on the long term, it is advised to use only .py files, which are true Python. Note also that Sage source code is made of .py files and do not use any kind of preparsing. preparsing, so this advice may be useful if you plan to let your code eventually enter Sage source code. If you want to migrate old .sage files into .py files, you can use the preparse function to help in the translation.