[BangPypers] Return values

Saager Mhatre saager.mhatre at gmail.com
Thu Sep 25 05:02:25 CEST 2014


On Sat, Sep 20, 2014 at 6:53 AM, Noufal Ibrahim KV <noufal at nibrahim.net.in>
wrote:

> On Sat, Sep 20 2014, Anand Chitipothu wrote:
>
>
> [...]
>
> > Oh, that feels like PHP. That style seems to be popular in that side of
> the
> > world.
> >
> > It might be a good idea to add consolidate method on the return value.
> > Something like:
> >
> > class StatsList(list):
> >     def consolidate(self):
> >         ..
> >
> > print get_stats(..)
> > print get_stats(..).consolidate()
>
> [...]
>
> That's a nice solution. It's similar to what Senthil suggested but I
> like the API better.


Alternatively, would it be possible to model Stats/StatsList as a composite
hierarchy (potentially with Courtesy Implementations
<http://martinfowler.com/bliki/CourtesyImplementation.html>)?

- d


More information about the BangPypers mailing list