'20' < 100

Dan Bishop danb_83 at yahoo.com
Fri May 2 00:29:59 EDT 2003


Dave Brueck <dave at pythonapocrypha.com> wrote in message news:<mailman.1051829166.5244.python-list at python.org>...

> But Python didn't really guess at anything - a guess would be implicitly
> call int on the string or something. This is a well-documented "feature"

It may be well-documented, but it's counterintuitive.  If str + int is
an error, then why isn't str < int (besides backward compatibility)?

> > strings should only be comparable to other basestrings and numbers
> > should only be comparable to other number types.
> >
> > Does anyone disagree? Why?
> 
> I disagree. :)
> 
> For one, to me the bug is elsewhere in the OP's program, not at the time
> of the comparison,

But an exception would at least make it obvious that a bug exists,
instead of letting it pass silently.




More information about the Python-list mailing list