Differences Between Python 3.5 and Python 3.6

Shashwat Agarwal
3 min read6 days ago
Photo by Chris Ried on Unsplash

The transition from Python 3.5 to Python 3.6 introduced a range of improvements and features that further refined the language’s capabilities. Here, we delve into the most significant differences between these two versions, highlighting their impact on Python development.

Formatted String Literals (f-strings)

One of the most celebrated features of Python 3.6 is the introduction of formatted string literals, also known as f-strings. These provide a concise and readable way to embed expressions within string literals using {} braces, prefixed with f. This addition simplifies string formatting compared to the older .format() method or % formatting.

name = "Alice"
print(f"Hello, {name}!") # Output: Hello, Alice!

Underscores in Numeric Literals

Python 3.6 introduced the ability to use underscores in numeric literals to improve readability, particularly for large numbers. This enhancement is purely cosmetic and does not affect the underlying value.

million = 1_000_000  # Easier to read

Secrets Module

The secrets module was added in Python 3.6 as a secure way to generate cryptographically strong random numbers and tokens. It’s particularly…

--

--

Shashwat Agarwal
Shashwat Agarwal

Written by Shashwat Agarwal

Software Developer passionate about Python, Philosophy, God, and Startups. Exploring innovative ideas and diving into Golang soon.

No responses yet