ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 27 Oct 2011 15:53:05 -0500Back-quotes in Sage or Pythonhttp://ask.sagemath.org/question/8419/back-quotes-in-sage-or-python/I have been cutting and pasting some of the examples in a pdf of William's new book, Sage for power users. All the single quotes paste as back-quotes (`) rather than single quotes ('). Is there some way to tell Sage (or Python) that these are equivalent?
I don't know if the back-quotes are intentional or an artifact of my pdf viewer.Thu, 27 Oct 2011 09:53:34 -0500http://ask.sagemath.org/question/8419/back-quotes-in-sage-or-python/Answer by Mike Hansen for <p>I have been cutting and pasting some of the examples in a pdf of William's new book, Sage for power users. All the single quotes paste as back-quotes (`) rather than single quotes ('). Is there some way to tell Sage (or Python) that these are equivalent?</p>
<p>I don't know if the back-quotes are intentional or an artifact of my pdf viewer.</p>
http://ask.sagemath.org/question/8419/back-quotes-in-sage-or-python/?answer=12825#post-id-12825I don't know if this is an issue with the PDF or your viewer, but one hackish way to do it is the following:
sage: def new_preparse(*args, **kwds):
....: return preparse(*args, **kwds).replace('`', "'")
....:
sage: sage.misc.preparser.preparse = new_preparse
Then you can do things like:
sage: print `cat`
cat
Note that this just does a "blind" replacement so something like
sage: print '`'
won't work correctly.
Thu, 27 Oct 2011 12:47:55 -0500http://ask.sagemath.org/question/8419/back-quotes-in-sage-or-python/?answer=12825#post-id-12825Answer by Jason Grout for <p>I have been cutting and pasting some of the examples in a pdf of William's new book, Sage for power users. All the single quotes paste as back-quotes (`) rather than single quotes ('). Is there some way to tell Sage (or Python) that these are equivalent?</p>
<p>I don't know if the back-quotes are intentional or an artifact of my pdf viewer.</p>
http://ask.sagemath.org/question/8419/back-quotes-in-sage-or-python/?answer=12827#post-id-12827It's a problem with the Sage book. Here is a change that fixes the problem: http://code.google.com/r/jasongrout-sagepowerbook/source/detail?r=51c71a663d03031458553f4c2778c9d3ab20faf8
Thu, 27 Oct 2011 15:24:13 -0500http://ask.sagemath.org/question/8419/back-quotes-in-sage-or-python/?answer=12827#post-id-12827Comment by jack for <p>It's a problem with the Sage book. Here is a change that fixes the problem: <a href="http://code.google.com/r/jasongrout-sagepowerbook/source/detail?r=51c71a663d03031458553f4c2778c9d3ab20faf8">http://code.google.com/r/jasongrout-s...</a></p>
http://ask.sagemath.org/question/8419/back-quotes-in-sage-or-python/?comment=21016#post-id-21016From what I can tell, this is a correction to the LaTeX version of the document, not the pdf version. I believe I only have access to the pdf version. Thu, 27 Oct 2011 15:53:05 -0500http://ask.sagemath.org/question/8419/back-quotes-in-sage-or-python/?comment=21016#post-id-21016