comparing str's with ints

Andrew Dalke dalke at dalkescientific.com
Mon Apr 29 15:07:26 EDT 2002


Frank Tobin:
>What in the world is supposed to be the semantics of comparing a string
>with an integer?  Seems like a type trap...

As I understand the history, earlier versions of Python didn't support
throwing exceptions from an internal cmp().  Instead, it used a
well-defined but arbitrary comparison scheme to handle failures.
Though that scheme kept being tweaked as mismatches were found between
it and expectations.

I agree that it's a type trap.

                    Andrew
                    dalke at dalkescientific.com







More information about the Python-list mailing list