How would I get return values in this case. (as I would a function)
class A(object):
def __init__(self,a,b):
self.a = a
self.b = b
self.run()
def run(self):
return a + b
When I do that I get an instance, how would I get a return value?
Thanks
James
Are you trying to do something like:
It’s not clear what you want and why.
__init__modifies the self object, but is required to returnNone(i.e. no return). Anything else will cause aTypeError.EDIT: To avoid creating an instance, you can override
__new__:You still haven’t quite explained why you need this.