[BangPypers] Return values

Noufal Ibrahim KV noufal at nibrahim.net.in
Sat Sep 20 12:52:37 CEST 2014

On Sat, Sep 20 2014, Senthil Kumaran wrote:


> One option to me looks like, don't have consolidate as parameter for
> this function, but do the operation outside.  Like providing a
> function called get_consolidated_stats, which will call get_stats and
> provide the consolidated result.
> The reason I am suggesting is, consolidation is one of the operation
> that be performed on the the collection and it seems that injecting
> that operation on the collection is 'limiting' the API.

I thought of this. If I can, for example, implement __add__ for the
stats, I can say something like

consolidated_stats = sum(get_stats(), Stats())

My only objection was if the consolidation is not trivial or depends on
the time of sampling, then it might be complex, if not
impossible. Still, this seems like the neatest way to do it. 


More information about the BangPypers mailing list