🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

Python Beginner

What is Module?

A Python file containing definitions and statements that can be imported and reused in other Python programs.

A module is simply a .py file. It can define functions, classes, and variables. Modules promote code reuse and organization. Import with import module_name or from module import function.

Python comes with a rich standard library of modules (os, sys, json, datetime, etc.). Third-party modules are installed via pip. Packages are directories of modules with an __init__.py file.

Related Terms

Dataclass
A decorator that automatically generates __init__, __repr__, __eq__, and other special methods for classes that mainly store data.
Magic Methods
Special double-underscore methods that define how Python objects behave with built-in operations and functions.
Dictionary
A built-in data structure that stores key-value pairs with O(1) average lookup time using hash tables.
Python Descriptors
Objects that define __get__, __set__, or __delete__ methods, controlling how attribute access works on other objects.
Python Typing Module
A standard library module providing type hints for function signatures and variables, enabling static analysis without runtime enforcement.
Python Metaclass
A class whose instances are classes themselves — the class of a class that controls how classes are created and behaved.
View All Python Terms →