# Xlator problem

the other way I know to tackle this parsing, using the

> method string.replace() also escapes backslashes.

> does anybody know of a way to parse expressions without
> these side-effects?

I think you are making a conceptual error here (one that I made too
earlier when I was working on mathtext). There is no such thing as a
raw string. the r'\somestring' is a hint to the python parser telling
it to escape all the slashes so you don't have to. Ie, raw strings
and strings are the same thing, and the r prefix just makes it easier
to write strings that have slashes in them.

r'\hi mom'

'\\hi mom'

So when these strings come back to you from Xlator or string.replace
displaying the \\, that is the right thing to do.

See, for example,

JDH

*


the other way I know to tackle this parsing, using the
method string.replace() also escapes backslashes.
does anybody know of a way to parse expressions without
these side-effects?
I think you are making a conceptual error here (one that I made too
earlier when I was working on mathtext). There is no such thing as a
raw string. the r’\somestring’ is a hint to the python parser telling
it to escape all the slashes so you don’t have to. Ie, raw strings
and strings are the same thing, and the r prefix just makes it easier
to write strings that have slashes in them.

r’\hi mom’
‘\hi mom’
So when these strings come back to you from Xlator or string.replace
displaying the \, that is the right thing to do.*

Ok, I got it. Thanks for the light. But then there must be another reason why mathtext is not processing the strings that come out of Xlator.

here is my plotting function

    a.plot([0,10],'w.')

a.set_xlim((0,10))

a.set_ylim((0,10))

a.set_title('Model Equations')

a.set_xticklabels([])

a.set_yticklabels([])

a.set_xticks([])

a.set_yticks([])

for i in range(len(eqlist)):

a.text(1,9-i,eqlist[i], fontsize=15)


where eqlist is a list of strings like [’$x \times y$’, …]

*See, for example,*

JDH
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
[https://lists.sourceforge.net/lists/listinfo/matplotlib-users](https://lists.sourceforge.net/lists/listinfo/matplotlib-users)




Flávio Codeço Coelho, PhD

Programa de Computação Científica

Fundação Oswaldo Cruz

Rio de Janeiro – Brasil

···

On Thu, 2004-04-29 at 17:56, John Hunter wrote: