A question for the Python Secret Police

A question for the Python Secret Police (or P. Inquisition, or whoever else:-). 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): ... (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) -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | ++++ see http://www.xs4all.nl/~tank/ ++++

A question for the Python Secret Police (or P. Inquisition, or whoever else:-).
That would be the Namespace Police in this case.
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.
That actually looks like a *good* reason to do exactly what you propose. --Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)

Jack Jansen <jack@oratrix.nl>:
Is the following morally allowed: class Foo(Foo):
Well, the standard admonitions against 'import *' apply. Whether using 'import *' or not, though, in the interests of clarity I think I would write it as class Foo(package1.mod.Foo): On the other hand, the funkiness factor of it does have a certain appeal! Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@cosc.canterbury.ac.nz +--------------------------------------+

A question for the Python Secret Police (or P. Inquisition, or whoever else:-).
That would be the Namespace Police in this case.
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.
That actually looks like a *good* reason to do exactly what you propose. --Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)

Jack Jansen <jack@oratrix.nl>:
Is the following morally allowed: class Foo(Foo):
Well, the standard admonitions against 'import *' apply. Whether using 'import *' or not, though, in the interests of clarity I think I would write it as class Foo(package1.mod.Foo): On the other hand, the funkiness factor of it does have a certain appeal! Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@cosc.canterbury.ac.nz +--------------------------------------+
participants (3)
-
Greg Ewing
-
Guido van Rossum
-
Jack Jansen