Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Namespaces in Python vs C++

What are the closest concepts in Python to namespace and using statements in C++?

like image 551
Konstantin Avatar asked Mar 16 '23 09:03

Konstantin


1 Answers

The closest equivalent to the namespace directive found in other languages is the Implicit Namespace Packages facility described in PEP 420 and introduced in Python 3.3. It allows for modules in multiple locations to be combined into a single, unified namespace rather than forcing the import of the first valid candidate found in sys.path.

There is no direct equivalent of using; importing specific names from a module adds them to the local scope unilaterally.

like image 88
Ignacio Vazquez-Abrams Avatar answered Mar 27 '23 11:03

Ignacio Vazquez-Abrams