[pypy-dev] gdbm

Maciej Fijalkowski fijall at gmail.com
Wed Nov 17 07:32:54 CET 2010


On Wed, Nov 17, 2010 at 1:24 AM, Dan Stromberg <drsalists at gmail.com> wrote:
>
> On Tue, Nov 16, 2010 at 8:38 AM, <exarkun at twistedmatrix.com> wrote:
>>
>> On 04:27 pm, drsalists at gmail.com wrote:
>> >On Tue, Nov 16, 2010 at 4:17 AM, Antonio Cuni <anto.cuni at gmail.com>
>> >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.

I think one of the points is that those are originally not related in
CPython. And someone somewhere *will* use this and complain. People do
crazy stuff with Python.

>
>>
>> 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.
>
>
> _______________________________________________
> pypy-dev at codespeak.net
> http://codespeak.net/mailman/listinfo/pypy-dev
>



More information about the Pypy-dev mailing list