Problem--Extending the behavior of an upstream package

Aahz aahz at
Wed Mar 11 05:33:19 CET 2009

In article <60848752-2c3f-4512-bf61-0bc11c919f99 at>,
Carl Banks  <pavlovevidence at> wrote:
>The problem comes when a different part of the upstream package also
>subclasses or creates a Box.  When an upstream function creates a box,
>it creates an upstream.packaging.Box instead of a
>mine.custom_packaging.Box, but I'd want it to do the latter.

The only clean way I'm aware of is to pass in an instance and use
instance.__class__ to create new instances.  Did you come up with
another idea?
Aahz (aahz at           <*>

"All problems in computer science can be solved by another level of     
indirection."  --Butler Lampson

More information about the Python-list mailing list