Ask Your Question

Revision history [back]

I think this is not specific to SageCell. It is the same in jupyter. implicit_multiplication changes the behaviour of the preparser, but the whole cell is preparsed according to the previous state of the preparser.

If, in a single cell, you write:

implicit_multiplication(True)
2x

You will get an error. But if you put the two lines in different cells, then it will work.

To take another example, you can do:

preparser(False)
type(1)

You will get <class 'sage.rings.integer.Integer'> because the whole cell was parsed before the parser is turned off. If you put the two lines in two different cells, you will get <class 'int'>, because the second line will not be preparsed anymore.

About the Sage preparser, see https://doc.sagemath.org/html/en/reference/repl/sage/repl/preparse.html

The sagecell works like a single jupyter cell.

I think this is not specific to SageCell. It is the same in jupyter. implicit_multiplication changes the behaviour of the preparser, but the whole cell is preparsed according to the previous state of the preparser.

If, in a single cell, you write:

implicit_multiplication(True)
2x

You will get an error. But if you put the two lines in different cells, then it will work.

To take another example, you can do:

preparser(False)
type(1)

You will get <class 'sage.rings.integer.Integer'> because the whole cell was parsed preparsed before the parser is turned off. If you put the two lines in two different cells, you will get <class 'int'>, because the second line will not be preparsed anymore.

About the Sage preparser, see https://doc.sagemath.org/html/en/reference/repl/sage/repl/preparse.html

The sagecell works like a single jupyter cell.

I think this is not specific to SageCell. It is the same in jupyter. implicit_multiplication changes the behaviour of the preparser, but the whole cell is preparsed according to the previous state of the preparser.

If, in a single cell, you write:

implicit_multiplication(True)
2x

You will get an error. But if you put the two lines in different cells, then it will work.

To take another example, you can do:

preparser(False)
type(1)

You will get <class 'sage.rings.integer.Integer'> because the whole cell was preparsed before the parser preparser is turned off. If you put the two lines in two different cells, you will get <class 'int'>, because the second line will not be preparsed anymore.

About the Sage preparser, see https://doc.sagemath.org/html/en/reference/repl/sage/repl/preparse.html

The sagecell works like a single jupyter cell.