Request: API's System.* objects converting to strings

Hey,

I’ve noticed that when debugging an event script, System.* objects (System.String, System.Int32, etc…) don’t seem to have string representations defined for those objects. I’m not 100% sure if these System.* objects are through Deadline or not, but if so, it would be super helpful if we could get a str() and repr() method implemented for these objects or the object’s metaclasses.

Example:

[code]

log.info(“Job.JobFrameList: %s” % (jobObj.JobFrameList))
Job.JobFrameList: System.Int32[/code]
Instead, I’d have to iterate through that object and print out each index to see what it contained.

This could be converted by implementing str() for the System.Int32 class similarly to:

>>>
>>> class MyListObj(object):
...     def __init__(self, *args, **kwargs):
...             self._list = kwargs.get("list", [])
...     def append(self, what):
...             self._list.append(what)
...     def __str__(self):
...             return "[%s]" % (", ".join(str(x) for x in self._list))
...
>>> b = MyListObj()
>>> b.append(1)
>>> b.append(2)
>>> b.append(3)
>>>
>>> print "list contents: %s" % (b)
list contents: [1, 2, 3]
>>>

Thoughts?

So those System.* classes are all base .NET classes, not Deadline code. The way the Python .NET integration works, when str() or repr_() is called on the Python .NET wrappers, it just calls the underlying .NET .ToString() function (essentially the equivalent to str/repr). So this should work fine for most simple .NET objects (like System.String, System.Int32, System.DateTime, etc)

Unfortunately, the ToString function just prints out object names for a lot of the more complex objects – including arrays, as you’ve noticed. This honestly isn’t too different from what Python does, except that Python does expand arrays/dictionaries automatically for you.

We could definitely look at whether or not we can tweak the Python .NET integration layer to do a similar thing for .NET enumerable types, but I’m not making promises since I can’t be sure if it’s actually doable without actually looking into it.

No problem, I appreciate the info and thanks for looking into it!