Suppose we have a class
class foo():
def __init__(self):
self.data = 10
...
def method(self):
...
self.free_indices.append(self.l[self.start_p])
var1 = self.l[self.search(var2[num])].pointer
...
It is clearly seen that the method and attribute calls within the class is too long and hence readability of code decreases. To fix that one could create a pair of methods
def get_some_att(self, var2, num):
return self.l[self.search(var2[num])].pointer
def append_index(self):
self.free_indices.append(self.l[self.start_p])
Which at the first glance seems reasonable, but suppose you have a dozen of such different calls, so what will you do? Will you create a dozen get_some_att
methods and therefore decrease the overall execution speed by a dramatic amount.
Or will you happily forget about all calls to increase speed, but make compromise on readability.
So what is the true pythonic™ way of handling thst kind of dilemmas?