Logo
Python Snacks
Logo
Articles
Advertise
Contact
Books
Sign Up

control flow

Conditionals, loops, match/case, flow modifiers.


Faster String Slicing in NumPy

Faster String Slicing in NumPy

A new vectorized approach to slicing string arrays in NumPy, shown to be up to 25x faster!

Jul 2, 2025

•

6 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

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

Writing Faster Code: 7 Simple Ways to Improve Your Python Loops

Writing Faster Code: 7 Simple Ways to Improve Your Python Loops

Practical tips to speed up your Python code and make your loops more efficient.

Sep 25, 2024

•

9 min read

Understanding Python's finally statement

Understanding Python's finally statement

This is a control flow tool you should've learned yesterday.

Aug 28, 2024

•

4 min read

A quick tutorial for the for/else construct in Python

A quick tutorial for the for/else construct in Python

Here's how you're able to use this and why sometimes it's more adventageous

Aug 22, 2024

•

5 min read

Comparing Python's for and while loops

Comparing Python's for and while loops

Here's when you should use one over the other

Aug 14, 2024

•

7 min read

Itertools: The One Package to Not Look Over

Itertools: The One Package to Not Look Over

Here's how you can leverage Python's itertools library to be more efficient with your looping

Jul 17, 2024

•

5 min read

Understanding Python’s Walrus Operator (:=) for Efficient Code

Understanding Python’s Walrus Operator (:=) for Efficient Code

Writing Cleaner, More Efficient Python Code with the Walrus Operator

Dec 20, 2023

•

5 min read

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.

Report abuse

Privacy policy

Terms of use

Powered by beehiiv