mark at microenh.com
Tue Oct 19 22:33:55 CEST 2010
Assume I have a objecy named obj in a module, module.py, in a package named package.
As I understand there are essentially three ways to access obj in a client module:
then everywhere func is used, it must be called using package.module.obj
from package.module import obj
then everywhere obj is used, it can be called using just obj.
from package.module import *
again everywhere obj is used, it can be called using just obj, but I have read the cautions about using wild imports, so I'm discounting this option.
import package.module as pm
then everywhere obj is used, it can be called using pm.obj
What are the pros and cons and recommended best practices?
More information about the CentralOH