[BangPypers] Return values
karra.etc at gmail.com
Sat Sep 20 13:13:52 CEST 2014
On Sat, Sep 20, 2014 at 4:18 PM, Noufal Ibrahim KV <noufal at nibrahim.net.in>
> On Sat, Sep 20 2014, Harish Vishwanath wrote:
> > Couple of approaches:
> > - Break the api into two. get_stats and get_stats_consolidated. This way,
> > the caller who doesn't know what is your default value of "consolidated"
> > argument is will not be confused.
> This explodes the API. It's similar to having two sort functions
> 'sort_increasing', and 'sort_decreasing' instead of just a single sort
> function with a flag to indicate ordering.
I think the comparison is not strictly apples to apples. In case of sort
ascending / descending flag parameterises the same sort algorithm. In your
case, you do some additional things (loop through and add up stuff,
perhaps) based on the value of the flag. That is very different.
More information about the BangPypers