Accept Python objects with serialization instructions for memoized functions

Description of the limitation and why it is relevant to address

As a developer I want to pass any python object (with e.g. a .serialize() method) to a memoized function so that I can input and return custom (data)classes in my app.

I think this is relevant for the VIKTOR platform because it saves execution time (thus a better end user experience) while maintaining the readability of the developer’s code

Submitter proposed design (optional)

Look for a specific method in the input/return objects (e.g. .serialize()) if they are not of type boolean, dictionary, float, int, list, none, string, tuple.

Current workarounds

Serialize the object before calling the memoized function, then deserialize it in the function.
Some disadvantages are: additional lines of code, loss of type hinting

3 Likes