
On Mar 19, 2010, at 4:50 AM, Antoine Pitrou wrote:
Glenn Linderman <glenn <at> nevcal.com> writes:
On the other hand, if the default behavior is to do an implicit conversion, I don't know of any way that that could be turned into an exception for those coders that don't want or don't like the particular type of implicit conversion chosen.
You still haven't given a good reason why we should raise an exception rather than do a comparison, though.
The fact that some particular coders don't like "the particular type of implicit conversion chosen" is a particularly weak argument. Python isn't a language construction framework; we try to choose useful defaults rather than simply give out a box of tools. If some people don't like the defaults (significant indentation, limitless precision integers, etc.), there are other choices out there.
The reason to prefer an exception is that decimal/float comparisons are more likely to be a programmer error than an intended behavior. Real use cases for decimal/float comparisons are rare and would be more clearly expressed with an explicit conversion using Decimal.from_float(). Of course there is a precedent, I can compare "120" < 140 in AWK and get an automatic implicit conversion ;-) Just because we can compare, doesn't mean we should. Raymond