Inheritence confusion

Kirk Strauser kirk at strauser.com
Fri Jun 11 23:45:06 CEST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

At 2004-06-11T20:47:44Z, "Robert Brewer" <fumanchu at amor.org> writes:

> Some options:
>
> 1) Override __init__ in the subclass.

Sigh.  I'd wanted to avoid that, but I guess I can make it a thin wrapper.

> 2) Pass the correct module as an argument to init.

Erk.

> 3) Perform ugly module-inspection hacks. Don't do this.

Agreed.  :)

> It would be a *lot* clearer if your example didn't re-use names in
> different modules.

OK, then, I shall again ask advice.  I foresee having 10-15 completely
distinct classes for clients to choose from.  I don't want to end up in the
position where a client program has to know that if it's importing
FtpEdiFiles, then it has to use the FtpEdiFileRetriever class, but if it's
importing ScpPngFiles, then it has to use the ScpPngFileRetriever class.  I
really want to use the same class name across all of the modules unless
doing otherwise is unavoidable.  What's a good way to handle this?
- -- 
Kirk Strauser
The Strauser Group
Open. Solutions. Simple.
http://www.strausergroup.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAyico5sRg+Y0CpvERAo3QAKCaC1wUewWaOLNTIO2bKpe8jI81hgCfUiPy
Ls+DY5TdE1oqxdz3JCDiJhw=
=vrvV
-----END PGP SIGNATURE-----



More information about the Python-list mailing list