[Python.NET] strange behavior when adding
John Burkhart
jfburkhart.reg at gmail.com
Fri Nov 9 12:51:55 CET 2012
Hello,
I'm working with a custom built set of .NET 4 assemblies.
The .NET assemblies have a type 'TimeSeries'.
These time series can have operations conducted on them (addition,
averaging, etc.), which returns a new type ('BinaryOperation'). I can do
this in IronPython no problem:
>>>
>>> type(tsvalues)
<type 'List[ITimeSeries]'>
>>> type(tsvalues[0])
<type 'TimeSeries'>
>>> sumts = tsvalues[0] + tsvalues[1]
>>> type(sumts)
<type 'BinaryOperation'>
>>>
However, in pythonnet the BinaryOperation fails... conducting the identical
steps in pythonnet I get the following:
>>> type(tsvalues)
System.Collections.Generic.0, Culture=neutral, PublicKeyToken=null]]
>>> type(tsvalues[0])
TimeSeries
>>> sumts = tsvalues[0]+tsvalues[1]
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-79-367816bc7679> in <module>()
----> 1 sumts = tsvalues[0]+tsvalues[1]
TypeError: unsupported operand type(s) for +: 'TimeSeries' and 'TimeSeries'
Any ideas on why pythonnet and IronPython would handle operations on my
class types differently? In pythonnet do my types have to have the
.__add__, .__sub__, etc. method-wrappers implemented??
Thank you,
john
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20121109/6a18bc25/attachment.html>
More information about the PythonDotNet
mailing list