Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is top level module in Python?

Tags:

python

I've met words such as top-level modules and top-level packages in Python documentation several times. This is the documentation about such concepts. What does these words mean?

like image 700
wow yoo Avatar asked Oct 21 '16 08:10

wow yoo


People also ask

What is top level of a module?

A top-level module is one which contains all other modules. A top-level module is not instantiated within any other module. For example, design modules are normally instantiated within top level testbench modules so that simulation can be run by providing input stimulus.

What is module level in Python?

In Python, Modules are simply files with the “. py” extension containing Python code that can be imported inside another Python Program. In simple terms, we can consider a module to be the same as a code library or a file that contains a set of functions that you want to include in your application.

What are the two types of modules in Python?

A module may contain functions, classes, lists, etc. Modules in Python can be of two types: Built-in Modules. User-defined Modules.


1 Answers

Modules can be nested inside each other. For example os.path is a path module nested inside os module. Top level module is the topmost one. I this case, it's an os module.

like image 114
Alexey Guseynov Avatar answered Sep 23 '22 21:09

Alexey Guseynov