Logo
Python Snacks
Logo
Articles
Advertise
Contact
Books
Sign Up

best-practices

Recommended or community-endorsed ways to write clean, maintainable code.


Understanding Python's Pandas Pivot Tables

Understanding Python's Pandas Pivot Tables

The one line solution to understanding your data easily.

Nov 12, 2025

•

7 min read

Using requirements.txt for your uv build

Using requirements.txt for your uv build

Don't have a pyproject.toml but you have a requirements.txt file? No problem, uv can handle that!

Nov 5, 2025

•

5 min read

Virtual Environments In Your Python Code using uv

Virtual Environments In Your Python Code using uv

Never create a virtual environment again using this really unique feature using the uv package

Oct 29, 2025

•

7 min read

Using Pre-commit Hooks for your Python Project

Using Pre-commit Hooks for your Python Project

Keep your code clean, consistent, and manageable with your team members.

Oct 15, 2025

•

6 min read

Shallow copies vs deep copies in Python

Shallow copies vs deep copies in Python

Here's how you go about copying data structures in your Python code.

Oct 1, 2025

•

6 min read

Python Generators - The One Tool to Add to Your Toolbelt

Python Generators - The One Tool to Add to Your Toolbelt

Sep 24, 2025

•

7 min read

Leveraging Pandas for Solving Business Problems

Leveraging Pandas for Solving Business Problems

A mini case study using patient data and one powerful Pandas function - groupby()

Sep 17, 2025

•

7 min read

The 6 most common matplotlib plots you'll use in 2025

The 6 most common matplotlib plots you'll use in 2025

From line charts to pie charts, here's 6 plots you'll likely use in 2025 and beyond for your analysis.

Sep 10, 2025

•

7 min read

How to Handle Python Exceptions: Stop Errors from Breaking Your Code

How to Handle Python Exceptions: Stop Errors from Breaking Your Code

Master try/except blocks, avoid common pitfalls, and implement proper error handling in your Python applications

Sep 3, 2025

•

6 min read

The Top 8 Python Pandas Operations You Should Know

The Top 8 Python Pandas Operations You Should Know

Using the go-to framework for data manipulation

Aug 20, 2025

•

7 min read

Mastering timezones in Python with UTC

Mastering timezones in Python with UTC

This is the reason why you should use UTC for anything time-related.

Aug 13, 2025

•

7 min read

Understanding Python's Context Managers

Understanding Python's Context Managers

Python Context Managers Tutorial: Prevent Resource Leaks and Database Connection Errors

Aug 6, 2025

•

6 min read

Why Python 3.14 GIL Update is Significant for Threading

Why Python 3.14 GIL Update is Significant for Threading

The GIL isn't a bottleneck anymore - threading is truly going threaded.

Jul 23, 2025

•

7 min read

Securing your API keys and reading them using Python

Securing your API keys and reading them using Python

See how to store your secrets both locally and on cloud platforms like AWS, GCP, and Azure.

Jul 16, 2025

•

7 min read

Running Shell Commands in Python (the right way)

Running Shell Commands in Python (the right way)

Leverage the subprocess module, but know there's a difference between subprocess.run() and subprocess.Popen()

Jun 25, 2025

•

5 min read

Using Python's LRU Cache

Using Python's LRU Cache

Caching your program's output can increase significantly. Using Python's functools.lru_cache decorator makes creating caches easy.

Jun 18, 2025

•

6 min read

Using pre-commit hooks for your Python project

Using pre-commit hooks for your Python project

We all forget to format, lint, and make sure print statements are removed.

Jun 11, 2025

•

7 min read

Python's match/case Statements: The Equivalent of Switch Statements

Python's match/case Statements: The Equivalent of Switch Statements

This feature, used in Python 3.10+, is an alternative to if/elif/else blocks. See how case and match statements are used.

Jun 4, 2025

•

5 min read

The Simplest Way to Understand The Difference Between For Loops and While Loops

The Simplest Way to Understand The Difference Between For Loops and While Loops

There's a major difference between for and while loops, and this explanation hits the key difference.

Mar 12, 2025

•

6 min read

A Cheat Sheet for Type Hinting in Python

A Cheat Sheet for Type Hinting in Python

Here's why you should be using type hinting for your python code - it's nothing but beneficial!

Feb 19, 2025

•

5 min read

The differences between Mutable and Immutable data types in Python

The differences between Mutable and Immutable data types in Python

A beginner-friendly guide to why some variables change behind your back (and others don't)

Feb 12, 2025

•

5 min read

Why Python doesn't have private methods

Why Python doesn't have private methods

Python relies on you to be trustworthy, but there's more to it.

Feb 5, 2025

•

5 min read

Python Won't Make You a Good Software Engineer

Python Won't Make You a Good Software Engineer

Here's 6 things that will make you a good engineer, no matter what languages you use.

Jan 29, 2025

•

5 min read

Python except: The Danger of Overgeneralizing Exceptions

Python except: The Danger of Overgeneralizing Exceptions

How catching every exception with ‘except’ in Python can break your code and hide critical errors.

Jan 22, 2025

•

6 min read

3 things I've learned in my career as a software engineer

3 things I've learned in my career as a software engineer

As someone who's considered "early career", here's 3 things I have learned.

Jan 16, 2025

•

7 min read

Load more
background

Become a better software engineer today.

Newsletter

Login

Upgrade to Pro

Sample Issue

Advertise

Tools

Tutorials

Templates

Resources

Newsletter

Blog

Latest Posts

Experts

Creators

Most Popular

Resources

Support

Recommendations

Software Engineering Books

© 2025 Python Snacks.

Privacy policy

Terms of use

Powered by beehiiv