[Tutor] Modularity

Mark Lawrence breamoreboy at yahoo.co.uk
Thu Jan 14 11:26:54 EST 2016


On 14/01/2016 15:27, James Chapman wrote:
> 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()

Without any context this is completely meaningless, so what the hell are 
you talking about?

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence



More information about the Tutor mailing list