I just don't get it
Eduardo Elgueta
eelgueta at navix.cl
Sat Feb 28 07:43:43 EST 2004
Stephen and everyone else,
Thank you very much for your answers. I'm not new to Python, but I
still have a long way to go
Ed.
Stephen Horne <steve at ninereeds.fsnet.co.uk> wrote in message news:<mcnv30h8h6ltc9370gf7all5mj58j4mjf0 at 4ax.com>...
> On Sat, 28 Feb 2004 00:14:29 +0000, Stephen Horne
> <steve at ninereeds.fsnet.co.uk> wrote:
>
> >If Python started trying to guess your intentions, and assumed that
> >you really meant to compare the values, a whole load of quite basic
> >things wouldn't work.
>
> Just thought I'd chuck in a different example of what could happen if
> Python started second guessing intentions.
>
> (1,) == 1 .......... the numbers are both 1, after all
>
> (1,) == () ......... maybe you're just checking they're both
> tuples, after all?
>
> But then for both those to be true, you also get...
>
> 1 == () ............ because 1 == (1,) == ()
> 2 == () ............ because 2 == (2,) == () by the same logic
>
> 1 == 2 ............. because 1 == () == 2
>
>
> In short, you either have to live with inconsistencies in ordering
> relationships that break standard algorithms and lead to all kinds of
> unexpected problems in any program over about 100 lines of code, or
> you have the ultimate egalitarian society of objects where every
> object is equal to every other object, irrespective of value or
> anything else.
>
> Neither seems attractive to me.
More information about the Python-list
mailing list