I am writing a python function with the following:
class myObj(object):
def __init__(self, args):
# there is code here
def newO(self, name, description):
if type(name)==str:
self.oname.append(name)
self.o.append(description)
elif type(name)==list:
for n in name:
self.oname.append(n)
self.o.append(description)
However I am led to believe this is not the best way to accomplish this. Whats a better way? I want to be able to call newO with a string or a list.