[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] BUG? rect __eq__
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] BUG? rect __eq__
- From: Phil Hassey <philhassey@xxxxxxxxx>
- Date: Tue, 6 Jun 2006 15:30:33 -0700 (PDT)
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Tue, 06 Jun 2006 18:30:48 -0400
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=36mIFu4SmdqaabLE5Ck3x/ncXoDfwkdBY7KLKq5HGGaT/zdkKSgj4LVpZecC2rVxUdtOMof+qIhTmQzltWr6fVpQ6ODrGXQjnTI4quyPQAdKqLuQWIqgp0wOy7ndjLPr8VAGfmYWT1zZ4PTrzZWnEGJ/CMWUabIsy1jFXK2mrAU= ;
- In-reply-to: <1149621569.13507.1.camel@toybox>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
I would have thought so too... but they don't seem to be as equal as they could be:
[phil@localhost ~]$ python
Python 2.4.1 (#2, Aug 25 2005, 18:20:57)
[GCC 4.0.1 (4.0.1-2mdk for Mandriva Linux release 2006.0)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> (0,0,10,10) != [0,0,10,10]
True
>>>
Joe Wreschnig <piman@xxxxxxxxxxxxxx> wrote: On Tue, 2006-06-06 at 22:12 +1000, Rene Dudfield wrote:
> Hi,
>
> thanks for the notes.
>
>
> Yes I agree the current behaviour is more useful, and probably more expected.
>
> Note that all of these are true:
> Rect(0,0,10,10) == [0,0,10,10]
> [0,0,10,10] == [0,0,10,10]
> Rect(0,0,10,10) == (0,0,10,10)
>
>
However:
> (0,0,10,10) != [0,0,10,10]
This would be news to me. Tuples and lists with the same elements are
equal in Python.
id(a) == id(b) is the wrong way to write it. Use "a is b".
--
Joe Wreschnig
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com