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

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to