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,
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=7xznb699ph.fsf%40ruckus.brouhaha.com&rnum=14&prev=/groups%3Fq%3Draw%2Bstring%2Bgroup:python%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26scoring%3Dd%26start%3D10%26sa%3DN

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 = self.figmgr.add_subplot(111)

    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,*
[http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=7xznb699ph.fsf%40ruckus.brouhaha.com&rnum=14&prev=/groups%3Fq%3Draw%2Bstring%2Bgroup:*python*%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26scoring%3Dd%26start%3D10%26sa%3DN](http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=7xznb699ph.fsf%40ruckus.brouhaha.com&rnum=14&prev=/groups%3Fq%3Draw%2Bstring%2Bgroup:*python*%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26scoring%3Dd%26start%3D10%26sa%3DN)

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.
[http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click](http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click)
_______________________________________________
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)

fiocruz4.jpg
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: