Aaron Watters added the comment:
Okay. I haven't looked but this should be well documented
somewhere because I found it very surprising (it crashed a large
run somewhere in the middle).
In the case of strings versus unicode I think it is possible
to hack around this by catching the exceptional case and
comparing character by character -- treating out of band
characters as larger than all unicode characters. I don't
see why this would cause any problems at any rate.
-- Aaron Watters
On Feb 1, 2008 6:47 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote:
>
> Guido van Rossum added the comment:
>
> > As I understand it comparisons between two objects should
> > always work.
>
> Hi Aaron! Glad to see you're back.
>
> It used to be that way when you & Jim wrote the first Python book. :-)
>
> Nowadays, comparisons *can* raise exceptions. Marc-Andre has explained
> why. In 3.0, this particular issue will go away due to a different
> treatment of Unicode, but many more cases will raise TypeError when < is
> used. == and != will generally work, though there are no absolute
> guarantees.
>
> ----------
> nosy: +gvanrossum
> resolution: -> rejected
> status: open -> closed
>
> __________________________________
> Tracker <[EMAIL PROTECTED]>
> <http://bugs.python.org/issue1997>
> __________________________________
>
Added file: http://bugs.python.org/file9348/unnamed
__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1997>
__________________________________
Okay. I haven't looked but this should be well
documented<br>somewhere because I found it very surprising (it crashed a
large<br>run somewhere in the middle).<br><br>In the case of strings versus
unicode I think it is possible<br>
to hack around this by catching the exceptional case and<br>comparing character
by character -- treating out of band<br>characters as larger than all unicode
characters. I don't<br>see why this would cause any problems at any
rate.<br>
<br> -- Aaron Watters<br><br><div class="gmail_quote">On Feb 1,
2008 6:47 PM, Guido van Rossum <<a href="mailto:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</a>> wrote:<br><blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex;
padding-left: 1ex;">
<br>Guido van Rossum added the comment:<br><div class="Ih2E3d"><br>> As I
understand it comparisons between two objects should<br>> always
work.<br><br></div>Hi Aaron! Glad to see you're back.<br><br>It used
to be that way when you & Jim wrote the first Python book. :-)<br>
<br>Nowadays, comparisons *can* raise exceptions. Marc-Andre has
explained<br>why. In 3.0, this particular issue will go away due to a
different<br>treatment of Unicode, but many more cases will raise TypeError
when < is<br>
used. == and != will generally work, though there are no
absolute<br>guarantees.<br><br>----------<br>nosy: +gvanrossum<br>resolution:
-> rejected<br>status: open -> closed<br><div><div></div><div
class="Wj3C7c"><br>
__________________________________<br>Tracker <<a href="mailto:[EMAIL
PROTECTED]">[EMAIL PROTECTED]</a>><br><<a
href="http://bugs.python.org/issue1997"
target="_blank">http://bugs.python.org/issue1997</a>><br>
__________________________________<br></div></div></blockquote></div><br>
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com