Skip to content

๐Ÿ Python by Example. Small, practical Python snippets showcasing language quirks, gotchas, and library behaviors Iโ€™ve encountered.

Notifications You must be signed in to change notification settings

matthewrv/python-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Python by Example ๐Ÿ

A collection of small Python code snippets demonstrating important (and sometimes surprising) behaviors of the language and libraries I use.

๐Ÿš€ Getting Started

Setting Up the Environment

  • NixOS users (like me ๐Ÿ˜‰): Simply run nix-shell, and youโ€™re ready to explore Pythonโ€™s intricacies.

  • Other systems: Use uv to configure the project:

    uv sync

    After this, you should be good to go!

Running Examples

Browse the examples/ directory (organized by topic), read the commented code to understand what each script does, and run it with Python. For example:

python examples/threads/sql_alchemy_is_not_thread_safe.py

Happy coding! ๐ŸŽ‰

๐Ÿ“‘ Index

builtins

  • booleans_are_integers - Demonstrates how Python booleans are actually a subtype of integers
  • round_is_not_math_round - Shows that Python's default rounding uses banker's rounding (round-to-even) rather than standard mathematical rounding

functions

threads

About

๐Ÿ Python by Example. Small, practical Python snippets showcasing language quirks, gotchas, and library behaviors Iโ€™ve encountered.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages