How can we return instance of class from ladon functions in python?

136 Views Asked by At

I want to return a instance of user defined class and list of instances of user defined class from a ladon function? Is it possible?

1

There are 1 best solutions below

1
NullPoiиteя On

this might help you its something like this

from ladon.ladonizer import ladonize
from ladon.types.ladontype import LadonType

class Response(LadonType):
    values = [int]

class MyService(object):
    @ladonize(int, int, rtype=Response)
    def foo(self, a, b):
        result = Response()
        result.values = [a+b, a*b]
        return result