You can do this with whatever class you want, but here’s a quick example using namedtuple
>>> from collections import namedtuple
>>> Point = namedtuple('Point', 'x y')
>>> def my_func():
return Point(1, 9)
>>> my_func().x
1
This code is completely useless though
8
solved function returning an object in python [closed]