I have a long and complicated method, I'll give the important parts:
def get_itter(self, sort_by=0): #sort_by is set to 0 for debugging purposes
...
r = self.parser(self.in_file) # parse a csv file
...
if type(sort_by) == int:
r = [i for i in r]
sort = sorted(r, key=sort_by)
...
Now my problem is that when I run this code it gives me an error: TypeError: 'int' object is not callable. Why is it giving me this error?
P.S. I am relatively new to Python and am trying to add some functionality to code that I did not write.
sort_bysupposed to represent? The column number?:)itemgetter()as the sort key. And useisinstance(sort_by, int)instead of testing for a fixed type.