import - "attach" a python module similar to R? -
in python, when import something:
import module when later want use functions created in module have say
module.foo() is there way "attach" module if call
foo() it knows mean use foo defined in module, long name not conflict name in current file?
from module import *
this imports symbols in module unless overriden __all__.
you can explicitly import (which better) symbols need.
from module import foo
it's typically preferred use later. better use module namespacing. there's nothing wrong module.foo() vs. foo(). once program gets large, quite bit refactoring.
Comments
Post a Comment