Re: Function "modes" vs. separate functions

2011-07-29 Thread Ben Finney
Rustom Mody writes: > Ben Finney said: > > But this is all getting rather generic and abstract. What specific > > real-world examples do you have in mind? > > regex match vs regex search? That's not showing a real-world example. Where is the code which is prone to “lots of shared code but can't

Re: Function "modes" vs. separate functions

2011-07-29 Thread Andrew Berg
On 2011.07.29 08:57 PM, Ben Finney wrote: > If they share a lot of code, either it *is* separable to common > functions (in which case, implement it that way), or the “same thing” > code is sufficiently complex that it's better to show it explicitly. > > But this is all getting rather generic and

Re: Function "modes" vs. separate functions (was: PyWart: os.path needs immediate attention!)

2011-07-29 Thread Rustom Mody
Ben Finney said: > But this is all getting rather generic and abstract. What specific > real-world examples do you have in mind? regex match vs regex search? -- http://mail.python.org/mailman/listinfo/python-list

Re: Function "modes" vs. separate functions

2011-07-29 Thread Ben Finney
Andrew Berg writes: > On 2011.07.29 07:50 PM, Steven D'Aprano wrote: > > Especially if the implementation looks like this: > > > > def get_thing(argument, flag): > > if flag: > > return one_thing(argument) > > else: > > return another_thing(argument) > > > Well, that wou