Forgetting "()" when calling methods
Tim Peters
tim.one at comcast.net
Mon Apr 28 10:29:34 EDT 2003
[Tim]
> I'm pretty sure that if Python had never supported meaningless
> (although consistent within a single run) comparisons, a compelling case
> for adding them couldn't have been made.
[Terry Reedy]
> Nor can I imagine a compelling case for exactly the current rules if
> they were not whay they currently are. Allowing 1j to compare to '1'
> but not 1 is pretty exoteric. The argument seem to be this: cmp(1j,
> '1') is so meaningless that it is ok to give an answer while cmp(1j,1)
> might be seen as meaningful (and lexicographically, it is) so therefor
> it must be forbidden.
No, the current state makes no sense. In very early Pythons, it wasn't
*possible* (for technical reasons) for a comparison to raise an exception
(well, it could, but it got silently ignored). When it became possible for
comparisons to raise exceptions, new types started doing so, but
pre-existing types generally didn't. complex is a quirky exception. It's
obvious that, in Python 3, Guido doesn't want
2 < "42"
to pass silently any more than he wants
2 + "42"
to pass silently. The current state is an inconsistent mish-mash moving
toward that.
More information about the Python-list
mailing list