How do i reduce this to a single function - the code is largely similar, just a direction of search toggle.

Veek M vek.m1234 at gmail.com
Fri Nov 7 15:52:22 CET 2014


Veek M wrote:


>                 new_col = self.b[row].index('def')
>                 self.w.cursor = row, new_col

>                 new_col = self.b[row].rindex('def')
>                 self.w.cursor = row, new_col

There's also the different methods index vs rindex. Does this sort of thing 
justify two functions and associated infrastructure (it's for vim so 2 x 3 
mode lines in my .vimrc)



More information about the Python-list mailing list