preparser(False) doesn't work with attach()
This is a more basic version of my previous question http://ask.sagemath.org/question/2469..., which had distracting details.
Background:
In William Stein's Sage for Power Users (http://wstein.org/books/sagebook/sage...), 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: N=2/3 + 2^3
sage: N
1
sage: preparser(True)
sage: M=2/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)
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: 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.
I think you may have to have some minimum "karma" in order to attach screenshots. There is a little icon at the top of the question area next to the bold, italic, etc. which looks like a computer screen; probably it's disabled until a certain point. Sadly, this is a necessary thing given the amount of spam we get...
Thanks. How did you put the grey boxes around the 'code'?
When you are typing, you should see some icons (just like the ones I mentioned) - and another one of those looks like 101010 or something. Highlight the code, and then click that. It will indent each line 4 spaces (you can also do this by hand, of course) and that is what is required to tell askbot this is code.