This is definitely a bug - I've opened CodePlex issue 3982 to track this 
(http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&WorkItemId=3982).
   Thanks for reporting it.  I suspect this is due to the fact that our enums 
don't implement compare, and we are doing a compare (and checking it's zero) 
instead of a simple equality check when comparing the lists.  Some interesting 
other data points are:

x = Color.Red
[x] == [x]

Prints True (because you're using the same boxed enum) and:

{Color.Red:Color.Red} == {Color.Red:Color.Red} also works (we're doing an 
equality check instead of a comparison).

Any input on how we should prioritize this?

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andrzej Krzywda
Sent: Tuesday, October 03, 2006 5:35 AM
To: Discussion of IronPython
Subject: [IronPython] Comparing clr objects in lists

Hello all,

We found an issue with comparing clr objects in lists.

IronPython 1.0.60816 on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. 
All rights reserved.
 >>> import clr
 >>> clr.AddReference('System.Drawing')
 >>> from System.Drawing import Color
 >>>
 >>> Color.Red == Color.Red
True
 >>> (Color.Red) == (Color.Red)
True
 >>> [Color.Red] == [Color.Red]
False
 >>> [(Color.Red)] == [(Color.Red)]
False

The same kind of comparison will work with IronPython objects.

Andrzej Krzywda
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to