[IronPython] subclasses of list with __mul__ defined

Glenn Jones glenn.k.jones+ipy at gmail.com
Tue Dec 9 17:37:04 CET 2008

Hi guys,

Another issue from our upgrade to IPy2:
class thing(list):
    def __init__(self, value):
        self.value = value

    def __mul__(self, other):
        return self.value * other
t1 = thing(3.0)
print t1 * 3.0

results in:

Traceback (most recent call last):
  File "testmat.py", line 12, in testmat.py
  File "Microsoft.Scripting.Core", line unknown, in New
  File "Microsoft.Scripting.Core", line unknown, in New
  File "Microsoft.Scripting.Core", line unknown, in ValidateArgumentTypes
ValueError: Expression of type 'System.Double' cannot be used for
constructor parameter of type 'System.Object'

This has the potential to cause us significant pain since a third-party
(pure python) library that we use relies on this behaving correctly.

We'll raise this as a bug on codeplex.

Glenn & Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20081209/1a484227/attachment.html>

More information about the Ironpython-users mailing list