[Tutor] Modularity

James Chapman james at uplinkzero.com
Thu Jan 14 10:27:57 EST 2016


I should have re-read that last reply before hitting send. Apologies
for the poor sentence construction!

Something I forgot to highlight before which might be related to your
initial question.

If you have a file called sound.py which contained a class called
WavFile, if you imported just sound like this:

        import sound

Then your class constructor would be called like this:

        wavFile = sound.WavFile()


Importing the module doesn't import the class, for that you'd do

        from sound import WavFile

        wavFile = WavFile()


More information about the Tutor mailing list