Ask Your Question

Back-quotes in Sage or Python

asked 2011-10-27 09:53:34 -0500

jack gravatar image

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.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2011-10-27 12:47:55 -0500

Mike Hansen gravatar image

I 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`

Note that this just does a "blind" replacement so something like

sage: print '`'

won't work correctly.

edit flag offensive delete link more

answered 2011-10-27 15:24:13 -0500

Jason Grout gravatar image

It's a problem with the Sage book. Here is a change that fixes the problem:

edit flag offensive delete link more


From 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.

jack gravatar imagejack ( 2011-10-27 15:53:05 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2011-10-27 09:53:34 -0500

Seen: 104 times

Last updated: Oct 27 '11