durusmail: qp: QPY h8 and unicode.replace
QPY h8 and unicode.replace
2008-05-02
2008-05-02
2008-05-04
2008-05-04
2008-05-05
2008-05-06
QPY h8 and unicode.replace
David K. Hess
2008-05-05
On May 4, 2008, at 7:02 AM, Binger David wrote:
>
>
> The problem is that replace (like strip and slice)  can
> break entities.
>
> w.replace(';', '.').


I have to agree with your reasoning. I just wish there was a more
obvious way to help folks (me) from shooting themselves in the foot.
Double h8.quoteing like I ran into can be tricky to track down.

The only thing I can think of is maybe a "strict" flag in qpy to tell
the h8 type to throw exceptions if it is operated on with something
that is not h8 - which should put a stop to implicit quoting of non-
constants. I suppose though that would make the code more verbose as
all quoting of non-constants would become explicit (lots of h8.quote
calls).

On the other hand, maybe quoting of a non-constant is better off being
explicit in the code....

Dave



reply