30 Python Best Practices, Tips, And Tricks

Improve your Python knowledge and skills

Erik van Baaren
Python Land

--

Here are 30 Python best practices, tips, and tricks. I’m sure they’ll help you procrastinate your actual work and still learn something useful in the process.

To learn Python properly, please have a look at my Python Course for beginners!

1. Use Python 3

In case you missed it: Python 2 is officially not supported as of January 1, 2020. This guide has a bunch of examples that only work in Python 3. If you’re still on Python 2.7, upgrade now.

If you’re on MacOS, you can use Homebrew to painlessly upgrade Python.

2. Check for a minimum required Python version

You can check for the Python version in your code, to make sure your users are not running your script with an incompatible version. Use this simple check:

3. Use IPython

--

--