[IronPython] Builtin functions are never bound

Sanghyeon Seo sanxiyn at gmail.com
Tue Feb 7 12:02:21 CET 2006


In CPython, there is an assumption that builtin functions are never
bound. What an obscure stuff. Hopefully an example would clarify this.

# ex.py
class C:
    method = cmp
c = C()
print c.method(1, 1)

$ python ex.py
0
$ ip ex.py
Traceback (most recent call last):
  File __main__, line unknown, in Initialize
TypeError: cmp() takes exactly 2 arguments (3 given)

PyPy has suffered this too:
http://codespeak.net/pipermail/pypy-svn/2005-May/004905.html

Standard library modules like optparse and unittest are known to rely
on this. I don't like this quirk at all, but perhaps you want to know
these stuffs...

Seo Sanghyeon



More information about the Ironpython-users mailing list