[Python-Dev] Advice in stat.py

Barry A. Warsaw barry@zope.com
Mon, 30 Jul 2001 01:38:33 -0400


>>>>> "Fred" == Fred L Drake, Jr <fdrake@acm.org> writes:

    Fred>   This is about the only kind of thing I've ever found it
    Fred> useful for: re-implementing a module's interface, but when I
    Fred> only want to change a few things.

I call it "aliasing" a module (i.e. aliasing module A's symbols
exported through module B).
    
    Fred> Needing to do this never feels like a good solution, and
    Fred> probably indicates that some object needs to accept a
    Fred> parameter that offers the module's interface instead of
    Fred> finding it by name.

Um, sure, but it's can be pretty inconvenient to export 193 symbols
this way :).

>>> len(dir(Defaults))
193

I've often thought that it would be nice to have better delegation
support in Python, and no __getattr__() doesn't really hack it.  I'm
encouraged that some of the Py2.2 descr-branch stuff might actually
make this valid programming technique more useful and then even I
could see (eventually) giving up on import-*.
    
-Barry