I try to make something like that :
class oObject(object):
def __init__(self, x = 0, y = 0, z = 0):
self.x = x
self.y = y
self.z = z
def asString (self, value):
return str(value)
vector = oObject(5,5,5)
# So i can do
asString(vector.x)
# But I want this kind of syntax
vector.x.asString()
It’s just an example, i don’t really want to convert integrer into a string. It’s more about class into a class.
You could either write a custom method for your
oObjectclass that returns the string of the givenkey, or maybe you could write a customVariantclass and wrap your values:Check out this reference as to how PyQt4 does it, with the QVariant class, which is actually from Qt. Normally python wouldn’t need this type, but it was necessary for C++ to represent the multiple types.