Hello there, my problem is that when I’m trying to use repr to rewrite the new-type class. The displayed output information is not showing correct information.
Here I made a simple comparison between the classic class and the new-type class. The classic one works just fine, but the new-type does not.
The reason I have to use the new-type class is because this is the only way to make inheritance behaving correctly. If you already understand why this is the only way, you can ignore the picture shown below.
This wouln’t get anything wrong because if I input the new-type object back to a python battery it still works and show me the ‘canot_show’ information. But it is just sad that I cannot directly see this in the Grasshopper output
Please tell me I’m being naive and there is an actual solution for this. Thanks!
Here is the code.
class OldType:
def __init__(self):
self._condition = 'Kinda_guud!'
def __repr__(self):
return 'custom_object<%s>' % self._condition
class NewType(object):
def __init__(self):
self._condition = 'Cannot_show'
def __repr__(self):
return 'custom_object<%s>' % self._condition
a = OldType()
b = NewType()