Sunday, December 02, 2007

IronPython Bug that Cost me a Can of Coke

Kamil Dworakowski (a Resolver developer) explains an obscure bug with comparing lists in IronPython 1, and how it cost him a can of coke:
The bug relates to IComparable and value types in the underlying framework and how IronPython implements equality in an attempt to remain faithful to Python.

3 comments:

  1. jlh@jlh-d520:~$ python
    Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32)
    [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> a=1
    >>> a==a
    True
    >>> [a]==[a]
    True
    >>> a
    1
    >>>

    ReplyDelete
  2. Hello Omaha Python Users group. :-)

    ReplyDelete
  3. For what it's worth the code you posted above does exactly the same thing in IronPython.

    >>> a = 1
    >>> [a] == [a]
    True

    The problem in IronPython is more complex than that and applies to specific value types!

    ReplyDelete

Note: only a member of this blog may post a comment.