Tag

sys.path

0 views collected around this technical thread.

Code Mala Tang
Code Mala Tang
Jan 7, 2025 · Fundamentals

Master Python Imports: Choose import, from, or * and Avoid Common Pitfalls

This guide explains the differences between Python's import statements—including "import X", "from X import Y", and "from X import *"—covers dynamic imports with __import__, sys.path handling, PYTHONPATH, PEP8 import ordering, __all__ usage, and the role of __name__ in module execution, helping you write cleaner, conflict‑free code.

ModulesPythondynamic-import
0 likes · 10 min read
Master Python Imports: Choose import, from, or * and Avoid Common Pitfalls
Python Programming Learning Circle
Python Programming Learning Circle
Jan 21, 2022 · Fundamentals

Difference Between python3 script.py and python3 -m module: Impact on sys.path

This article explains how running a Python file directly with python3 script.py differs from using python3 -m module, focusing on the resulting changes to sys.path, import behavior, and the search order of modules.

@ImportPythoncommand line
0 likes · 4 min read
Difference Between python3 script.py and python3 -m module: Impact on sys.path
Python Programming Learning Circle
Python Programming Learning Circle
Nov 6, 2021 · Fundamentals

Understanding Python Modules, Packages, and the Import System

This article explains the concepts of Python modules and packages, the mechanics of import statements, the search path and caching behavior, the roles of finders and loaders, and how the import system has evolved through PEP 302 and PEP 420 to support regular and namespace packages.

Import SystemModulesNamespace Packages
0 likes · 22 min read
Understanding Python Modules, Packages, and the Import System