Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

preparser(False) doesn't work with attach()

This is a more basic version of my previous question http://ask.sagemath.org/question/24696/preparsefalse-still-not-working/, which had distracting details.

Background:

In William Stein's Sage for Power Users (http://wstein.org/books/sagebook/sagebook.pdf), end of Section 2.2 and top of page 13, there is an example of how to turn the preparser off in the sage interpreter. The example works as claimed and here it is copied from my own computer:


| Sage Version 5.3, Release Date: 2012-09-08 | | Type "notebook()" for the browser-based notebook interface. |

| Type "help()" for help. |

sage: preparser(False) sage: 2/3 + 2^3 1 sage: preparser(True) sage: 2/3 + 2^3 26/3

Here is another example:

But now suppose that I want to put (almost) exactly the same lines into a .sage file called 'preparsertest.sage', close sage, reopen it, and then type attach('preparsertest.sage') into the interpreter. Naively I expect the same behaviour but that's not what I get.

Here is the content of 'preparsertest.sage':

preparser(False)

N=2/3 + 2^3

Here is the output from the interpreter:

sage: attach('preparsertest.sage') sage: N 26/3 sage: type(N) <type 'sage.rings.rational.rational'="">

So it seems that when I attach 'preparsertest.sage', the line preparser(False) is not being read.

What gives?

preparser(False) doesn't work with attach()

This is a more basic version of my previous question http://ask.sagemath.org/question/24696/preparsefalse-still-not-working/, which had distracting details.

Background:

In William Stein's Sage for Power Users (http://wstein.org/books/sagebook/sagebook.pdf), end of Section 2.2 and top of page 13, there is an example of how to turn the preparser off in the sage interpreter. The example works as claimed and here it is copied from my own computer:


| Sage Version 5.3, Release Date: 2012-09-08 | | Type "notebook()" for the browser-based notebook interface. |

| Type "help()" for help. |

sage: preparser(False) sage: 2/3 N=2/3 + 2^3 sage: N 1 sage: preparser(True) sage: 2/3 M=2/3 + 2^3 sage: M 26/3

Here is another example:

But now suppose that I want to put (almost) exactly the same lines into a .sage file called 'preparsertest.sage', close sage, reopen it, and then type attach('preparsertest.sage') into the interpreter. Naively I expect the same behaviour but that's not what I get.

Here is the content of 'preparsertest.sage':

preparser(False)

N=2/3 + 2^3

preparser(True

M=2/3+2^3

Here is the output from the interpreter:

sage: attach('preparsertest.sage') sage: N 26/3 sage: type(N) <type 'sage.rings.rational.rational'="">M 26/3

So it seems that when I attach 'preparsertest.sage', the line preparser(False) is not being read.

What gives?

P.S. I tried to figure out how to attach a screen shot but it didn't work, and I didn't find instructions on ask.sagemath.org.

preparser(False) doesn't work with attach()

This is a more basic version of my previous question http://ask.sagemath.org/question/24696/preparsefalse-still-not-working/, which had distracting details.

Background:

In William Stein's Sage for Power Users (http://wstein.org/books/sagebook/sagebook.pdf), end of Section 2.2 and top of page 13, there is an example of how to turn the preparser off in the sage interpreter. The example works as claimed and here it is copied from my own computer:

sage: preparser(False) preparser(False)

sage: N=2/3 + 2^3 sage: N 1 sage: preparser(True) 2^3

sage: N

1

sage: preparser(True)

sage: M=2/3 + 2^3 sage: M 2^3

sage: M

26/3

But now suppose that I want to put (almost) exactly the same lines into a .sage file called 'preparsertest.sage', close sage, reopen it, and then type attach('preparsertest.sage') into the interpreter. Naively I expect the same behaviour but that's not what I get.

Here is the content of 'preparsertest.sage':

preparser(False)

N=2/3 + 2^3

preparser(Truepreparser(True)

M=2/3+2^3

Here is the output from the interpreter:

sage: attach('preparsertest.sage') sage: N 26/3 sage: M attach('preparsertest.sage')

sage: N

26/3

sage: M

26/3

So it seems that when I attach 'preparsertest.sage', the line preparser(False) is not being read.

What gives?

P.S. I tried to figure out how to attach a screen shot but it didn't work, and I didn't find instructions on ask.sagemath.org.

click to hide/show revision 4
No.4 Revision

preparser(False) doesn't work with attach()

This is a more basic version of my previous question http://ask.sagemath.org/question/24696/preparsefalse-still-not-working/, which had distracting details.

Background:

In William Stein's Sage for Power Users (http://wstein.org/books/sagebook/sagebook.pdf), end of Section 2.2 and top of page 13, there is an example of how to turn the preparser off in the sage interpreter. The example works as claimed and here it is copied from my own computer:

sage: preparser(False)

sage: preparser(False)

sage: N=2/3 + 2^3

sage: N

1

sage: preparser(True)

2^3 sage: N 1 sage: preparser(True) sage: M=2/3 + 2^3

sage: M

26/3

2^3 sage: M 26/3

But now suppose that I want to put (almost) exactly the same lines into a .sage file called 'preparsertest.sage', close sage, reopen it, and then type attach('preparsertest.sage') into the interpreter. Naively I expect the same behaviour but that's not what I get.

Here is the content of 'preparsertest.sage':

preparser(False)

preparser(False)

N=2/3 + 2^3

preparser(True)

M=2/3+2^3

2^3 preparser(True) M=2/3+2^3

Here is the output from the interpreter:

sage: attach('preparsertest.sage')

sage: N

26/3

sage: M

26/3

sage: attach('preparsertest.sage')

sage: N

26/3

sage: M

26/3

So it seems that when I attach 'preparsertest.sage', the line preparser(False) is not being read.

What gives?

P.S. I tried to figure out how to attach a screen shot but it didn't work, and I didn't find instructions on ask.sagemath.org.