why () is () and [] is [] work in other way?

Chris Angelico rosuav at gmail.com
Fri Apr 20 15:21:56 EDT 2012


On Sat, Apr 21, 2012 at 5:10 AM, dmitrey <dmitrey15 at gmail.com> wrote:
> I have spent some time searching for a bug in my code, it was due to
> different work of "is" with () and []:
>>>> () is ()
> True
>>>> [] is []
> False

Okay, let's take a step back. What do you expect "is" to be doing? It
doesn't check for equality.

ChrisA



More information about the Python-list mailing list