On 30/11/2017 22:08, Alan Gauld via Tutor wrote:
On 30/11/17 15:37, Shall, Sydney wrote:
My problem is with constructing a sub-class.
My sub-class is constructed as follows:
import Population_ProductivityV24 as POCWP
Note that POCWP is an alias for the *module* Population_ProductivityV24.
It is not a class.
line 27 : class SimulateCycleZero(POCWP):
Here you define a class that subclasses your imported module.
Frankly I'm surprised that you don't get an error there
but hey...
line 28 : def __init__(self, dirname_p):
But this is now an init for a subclass of module.
The error message is as follows:
File
"/Users/sydney/AnacondaProjects/Capital/Capital_with_productivity/Current_Versions/Simulate_Cycle_Zero_V3.py",
line 27, in <module>
class SimulateCycleZero(POCWP):
TypeError: module.__init__() takes at most 2 arguments (3 given)
So I'm guessing the use of a module to subclass
has confused things and I confess I'm not clear on
exactly what is going on and why you get this message.
But I'm pretty sure you don;t want to subclass your
imported module and thats the mistake.
Thanks to Alan and Peter for explaining sub-classing to me. I understand
a bit better now. My program is corrected and does not give the error
any more.
--
Sydney
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor