>>> class test():
... def add(self):
... a = 3+5
... b = 4+9
... return a,b
...
>>> x = test()
>>> x.add()
(8, 13)
>>> z = x.add()
>>> z[0]
8
>>> z[1]
13
I looking for way to read individual variable like value of a
and b
using variable name not z[0]
or z[1]
.
I am also trying to avoid using global variables.
You can also use a kind of this shamanism:
it decorates your method with dictonary (thus, named values) and tranpose them to the properties of the object, i.e. it will work as: