On Tue, Nov 16, 2010 at 8:38 AM, <[email protected]> wrote: > On 04:27 pm, [email protected] wrote: > >On Tue, Nov 16, 2010 at 4:17 AM, Antonio Cuni <[email protected]> > >wrote: > >>Sounds fine, do you feel like implementing it? :-) > >> > >>Moreover, I also agree with amaury that your code is very similar to > >>the > >>one in the current dbm.py, so we should maybe try to refactor things > >>to > >>share common parts between the twos. > >I'd be happy to. > > > >Would sharing based on inheritance or a more functional approach be > >preferred? > > No, avoid inheritance where possible. Composition is preferred. > Due to performance? Or "flat is better than nested" - as more of a philosophical issue? I'm not arguing for inheritance, just wanting to understand the reasoning behind it.
> As for "functional", I don't really know what approach you're describing > with that word. > I mean something like what you'd do in Lisp, ML or Haskell (not that I know any of those that well). I suppose in this case it would mean functools.partial() as a decorator, or perhaps a wrapper around functools.partial() used as a decorator. Then again, maybe functools.partial() imposes its own performance penalty? That's part of why I'm wondering if avoiding inheritance is a performance-related goal.
_______________________________________________ [email protected] http://codespeak.net/mailman/listinfo/pypy-dev
