python when to use classes vs functions code example
Example: which is better for a better code.function or class
class Person(object):
def __init__(self, arg1, arg2):
self.arg1 = arg1
self.arg2 = arg2
def compute(self, other):
""" Example of bad class design, don't care about the result """
return self.arg1 + self.arg2 % other
fuction thinks function is better,but probably class is everything.