This project is a collection of Jupyter Notebooks designed to demonstrate various features and concepts in Python. Each notebook focuses on a specific topic, providing explanations and executable code examples. The rich
library is used extensively throughout the notebooks for enhanced, colorful terminal output.
Below is a list of the Jupyter Notebooks included in this project and a brief description of their content:
Classes.ipynb
: Explores Python classes, including object-oriented programming principles, data classes such ascollections.namedtuple
,typing.NamedTuple
, anddataclasses.dataclass
.Comprehensions.ipynb
: Covers list and dictionary comprehensions, offering concise ways to create lists and dictionaries.Coroutines.ipynb
: Demonstrates the use of generator functions and coroutines in Python for asynchronous programming.Pattern matching.ipynb
: Illustrates structural pattern matching, a feature introduced in Python 3.10, with examples of conditional cases and destructuring.Python basics.ipynb
: Reviews fundamental Python concepts, including variable assignment (one-to-many, many-to-many, packing/unpacking, swapping), data structures (lists, tuples, sets, dictionaries), string formatting and slicing, functions (named and positional arguments), generator expressions, list comprehensions, conditional expressions, and lambda functions.Rich showcase.ipynb
: Showcases the capabilities of therich
library for creating beautiful and informative terminal output. Examples includeprint
,pretty
,inspect
,Align
,Text
,Panel
,Rule
,Columns
,Group
,Padding
,Table
, andMarkdown
rendering.RuntimeDocumentation.ipynb
: Provides examples of how to access runtime documentation and inspect class and instance attributes using tools likeinspect
,__dict__
, and the built-inhelp()
function.
Before running these notebooks, ensure you have Python installed (preferably Python 3.10 or newer to support all features like pattern matching). You will also need Jupyter Notebook or JupyterLab.
To install the necessary libraries, you can use pip:
pip install jupyterlab rich
- Clone this repository to your local machine.
- Navigate to the project directory in your terminal.
- Start JupyterLab by running:
jupyter lab
- Open the desired
.ipynb
file from the JupyterLab interface and run the cells to see the demonstrations.
Contributions are welcome! If you have suggestions for new notebooks, improvements to existing ones, or find any issues, please feel free to open an issue or submit a pull request.