On May 2, 2008, at 6:12 PM, Binger David wrote: > I think replace needs to be different because > you don't have much reason to know that a particular > call will preserve the 'already-xml-quoted' property. I am not sure I understand what you mean. In any case, what would seem to me to be natural and consistent behaviour is to just quote the match and/or replacement strings, if they are themselves not yet an h8 instance. Am I being too naive there? Anyhow, shouldn't it work in a same way as it does when mixing unicode() and str() instances: $ python Python 2.5.1 (r251:54863, Feb 4 2008, 21:48:13) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> u = u"uvw" >>> s = "stu" >>> u.replace("u", u) u'uvwvw' >>> u.replace("u", "uvw") u'uvwvw' >>> s.replace("u", u) u'stuvw' >>> s.replace("u", "uvw") 'stuvw' >>> s.replace(u"u", "uvw") u'stuvw' i.e. mixing any str() instances with unicode() instances will always convert all to unicode... I had come across similar issues while working on evoque, that I noted about here: http://mail.mems-exchange.org/durusmail/qp/387/ mario > On May 2, 2008, at 10:58 AM, David K. Hess wrote: > >> What I'm running into appears to be that h8.replace returns a >> unicode instance instead of an h8 instance. >> >> Would it be more appropriate if all of the h8 inherited methods >> returned h8 instances instead? Or am I missing something.... >> >> Dave