[Python-Dev] A question for the Python Secret Police
Guido van Rossum
guido@beopen.com
Wed, 09 Aug 2000 07:42:49 -0500
> A question for the Python Secret Police (or P. Inquisition, or whoever
> else:-).
That would be the Namespace Police in this case.
> Is the following morally allowed:
>
> package1/mod.py:
> class Foo:
> def method1(self):
> ...
>
> package2/mod.py:
> from package1.mod import *
>
> class Foo(Foo):
> def method2(self):
> ...
I see no problem with this. It's totally well-defined and I don't
expect I'll ever have a reason to disallow it. Future picky compilers
or IDEs might warn about a redefined name, but I suppose you can live
with that given that it's machine-generated.
> (The background is that the modules are machine-generated and contain
> AppleEvent classes. There's a large set of standard classes, such as
> Standard_Suite, and applications can signal that they implement
> Standard_Suite with a couple of extensions to it. So, in the
> Application-X Standard_Suite I'd like to import everything from the
> standard Standard_Suite and override/add those methods that are
> specific to Application X)
That actually looks like a *good* reason to do exactly what you
propose.
--Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)