Skip to Content
Scientific Computing with Python - Second Edition
book

Scientific Computing with Python - Second Edition

by Claus Führer, Claus Fuhrer, Jan Erik Solem, Olivier Verdier
July 2021
Intermediate to advanced
392 pages
9h 40m
English
Packt Publishing
Content preview from Scientific Computing with Python - Second Edition
Namespaces, Scopes, and Modules

In this chapter, we'll cover Python modules. Modules are files containing functions and class definitions. The concept of a namespace and the scope of variables across functions and modules are also explained in this chapter.

The following topics will be covered in this chapter:

  • Namespaces
  • The scope of a variable
  • Modules

13.1 Namespaces

Names of Python objects, such as the names of variables, classes, functions, and modules, are collected in namespaces. Modules and classes have their own named namespaces with the same name as these objects. These namespaces are created when a module is imported or a class is instantiated. The lifetime of a namespace of a module is as long as the current Python session. The ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Scientific Computing with Python 3

Scientific Computing with Python 3

Claus Führer, Claus Fuhrer, Jan Erik Solem, Olivier Verdier
Mastering Numerical Computing with NumPy

Mastering Numerical Computing with NumPy

Umit Mert Cakmak, Tiago Antao, Mert Cuhadaroglu

Publisher Resources

ISBN: 9781838822323Supplemental Content