[Python-Dev] Re: Int FutureWarnings and other 2.4 TODOs

Michael Chermside mcherm at mcherm.com
Thu Dec 4 09:08:29 EST 2003

Guido writes:
> Hmm...  I'm not very familiar with the Bridge pattern (and my GoF book
> is on one of 65 boxes still in the garage waiting until we move into a
> larger house :-).  Can you give a little more detail about how this
> would be done?

If I understand it properly (and I DID check my copy of GOF which isn't
packed <wink>), it may be better recognized by its alternative name:
"Handle/Body". The basic idea is to add a level of indirection... the
GOF name the "front" object the "Abstraction" and the "back" object
the "Implementor".

And it seems like a poor choice for implementing ints, which by
definition should be designed for the minimum possible overhead, unless
that "front" object can be made VERY lightweight. (Hmm... to avoid
cache effects we might want to store the "abstraction" adjacent in
memory to the "implementor". And if we did THAT we might even be able
to dispense with even a pointer in the "abstraction". But now I've
talked myself out of the bridge pattern into something more like just
having two separate types... really 3 now, since there's a third
layout needed to handle user-designed int subclasses. I still don't
like it.)

-- Michael Chermside

More information about the Python-Dev mailing list