Skip to Content
The Quick Python Book, Third Edition
book

The Quick Python Book, Third Edition

by Naomi Ceder, David Fugate
May 2018
Beginner
472 pages
15h 3m
English
Manning Publications
Content preview from The Quick Python Book, Third Edition

Chapter 10. Modules and scoping rules

This chapter covers:

  • Defining a module
  • Writing a first module
  • Using the import statement
  • Modifying the module search path
  • Making names private in modules
  • Importing standard library and third-party modules
  • Understanding Python scoping rules and namespaces

Modules are used to organize larger Python projects. The Python standard library is split into modules to make it more manageable. You don’t need to organize your own code into modules, but if you’re writing any programs that are more than a few pages long or any code that you want to reuse, you should probably do so.

10.1. What is a module?

A module is a file containing code. It defines a group of Python functions or other objects, and the name of ...

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

Think Python, 3rd Edition

Think Python, 3rd Edition

Allen Downey
Learn Python Programming - Third Edition

Learn Python Programming - Third Edition

Fabrizio Romano, Heinrich Kruger

Publisher Resources

ISBN: 9781617294037Publisher SupportOtherPublisher WebsiteSupplemental ContentErrata PagePurchase Link