limit module import to only certain symbols?
Thomas Heller
theller at python.net
Thu Jun 26 16:02:44 EDT 2003
More information about the Python-list mailing list
Thu Jun 26 16:02:44 EDT 2003
- Previous message (by thread): better way than: myPage += 'more html' , ...
- Next message (by thread): limit module import to only certain symbols?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Kevin Howe" <khowe at perfnet.ca> writes: > Say I have the following module named "mymodule" > > import string > var1 = 'a' > var2 = 'b' > > And I want to import its symbols into another script: > > from mymodule import * > > This will import 3 symbols (string, var1, var2) > > Is it possible to limit it so that import * will only import specified > items? So that: > > from mymodule import * > > Would import only var1 and var2? You have to write __all__ = ["var1", "var2"] in your mymodule. Thomas
- Previous message (by thread): better way than: myPage += 'more html' , ...
- Next message (by thread): limit module import to only certain symbols?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list