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

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -