We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Import Deep Dive

Formal Metadata

Title
Import Deep Dive
Title of Series
Part Number
54
Number of Parts
173
Author
License
CC Attribution - NonCommercial - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this
Identifiers
Publisher
Release Date
Language
Production PlaceBilbao, Euskadi, Spain

Content Metadata

Subject Area
Genre
Abstract
Petr Viktorin - Import Deep Dive Whatever you need to do with Python, you can probably import a library for it. But what exactly happens when you use that import statement? How does a source file that you've installed or written become a Python module object, providing functions or classes for you to play with? While the import mechanism is relatively well-documented in the reference and dozens of PEPs, sometimes even Python veterans are caught by surprise. And some details are little-known: did you know you can import from zip archives? Write CPython modules in C, or even a dialect of Lisp? Or import from URLs (which might not be a good idea)? This talk explains exactly what can happen when you use the import statement – from the mundane machinery of searching PYTHONPATH through subtle details of packages and import loops, to deep internals of custom importers and C extension loading.
Keywords