The Real Python Podcast cover image

Exploring the New Features of Python 3.10

The Real Python Podcast

00:00

How to Check if a Version Is Greater Than Three Dot Ten in a Test.

The standard way of sort of checking what version you're running from within your code is to either use a sis dot version or sisdot version m po. So if you're using si dot version and a string comparison, you will get the wrong answer if you think you're using the minimum version. The right way to do this is to use version impo instead. It returns a tupple. And that tupple has the major and the minor version in it. Three comma six is less than three coma ten, the way it should be. Several of the linters out there, including flake eight, will look for this problem.

Transcript
Play full episode

The AI-powered Podcast Player

Save insights by tapping your headphones, chat with episodes, discover the best highlights - and more!
App store bannerPlay store banner
Get the app