[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] Odd key code behaviour



Michael Robin wrote:
> 
> I always wondered why Python even included "is".
> Given "explicit is better than implicit" and
> the anti-TMTOWTDI senitments, I'd think that
> the explict:
>         id(x) == id(y)
> is much better than:
>         x is y.

A thread like this just came up on the Tutor list.  Remember one of
Python's goals is to allow people to produce naturally looking source
code, and "x is y" is just a natural thing to write.  Especially for new
programmers who might not have much of a clue of how objects are dealt
with internally.

> I always do this when I want to compare object
> identity because it's so much more self documenting.

I don't really see a difference.  "is" can only be used in the one sense
anyhow, so it acts as a constant alias for "id(x) == id(y)".  Given this
there's not really a chance that anybody could confuse it with anything
else.

Anyhow, just wanted to offer another POV on this.  Sorry for being
off-topic.  :-)

-- 
======================================================================
Paul Sidorsky                                          Calgary, Canada
paulsid@shaw.ca                        http://members.shaw.ca/paulsid/
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org