Skip to content

beNative/jupyter_examples

Repository files navigation

Python Features Showcase

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.

Notebooks

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 as collections.namedtuple, typing.NamedTuple, and dataclasses.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 the rich library for creating beautiful and informative terminal output. Examples include print, pretty, inspect, Align, Text, Panel, Rule, Columns, Group, Padding, Table, and Markdown rendering.
  • RuntimeDocumentation.ipynb: Provides examples of how to access runtime documentation and inspect class and instance attributes using tools like inspect, __dict__, and the built-in help() function.

Prerequisites

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

How to Use

  1. Clone this repository to your local machine.
  2. Navigate to the project directory in your terminal.
  3. Start JupyterLab by running:
    jupyter lab
  4. Open the desired .ipynb file from the JupyterLab interface and run the cells to see the demonstrations.

Contributing

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •