[Tutor] Importing Modules Within Classes
Daniel Watkins
daniel at thewatkins.org.uk
Fri Oct 7 02:18:24 CEST 2005
Recently, there has been an example of someone importing modules within
a class definition. eg:
class Exemplar:
import re
...use re...
It seems obvious to me that this is incorrect, though more through
training than actual observation on my part, and it should be:
import re
class Exemplar:
...use re...
However, someone (I don't recall who) said that there were occasions
when it would be appropriate to import modules the former way. I was
just wondering under what circumstances importing should be done this
way?
Cheers,
Dan
More information about the Tutor
mailing list