[Python-ideas] Add a feature similar to C++ "using some_namespace"

Steven D'Aprano steve at pearwood.info
Mon Feb 7 22:48:37 CET 2011


Manuel Bärenz wrote:
> In C++, the the approach to the namespace problem is having different 
> namespaces that should not contain different definitions of the same name.
> Members of a namespace can be accessed explicitly by e.g. calling 
> "std::cout<<  etc." or "using namespace std; cout<<  etc."

This is like the "with" statement of Pascal, and is already a Python FAQ:


http://docs.python.org/faq/design.html#why-doesn-t-python-have-a-with-statement-for-attribute-assignments


-- 
Steven



More information about the Python-ideas mailing list