Jun-06-2018, 04:08 PM
I am wondering if my conversion on this dictionary was done correctly. Take a look at the way this was written in py2:
def new_item(self,raw_string): the_type=raw_string.split(",")[0] if self.constructors.has_key(the_type): return self.constructors[the_type](raw_string) else: return NoneI want to say with the changes from py2 to py3 that the new method should be:
def new_item(self,raw_string): the_type=raw_string.split(",")[0] if the_type in self.constructors: return the_type in self.constructors[raw_string] else: return NoneIf it helps the initialization for constructors is:
self.constructors={"None":None}The problem for me is that I am not sure what was meant by the py2 return statement:
return self.constructors[the_type](raw_string)