Syntactic Sugar: Why Python Is Sweet and Pythonic
Python has several pieces of syntax that are syntactic sugar. This sugar is syntax that isn’t strictly necessary but gives Python some of its flavor as a readable, beginner-friendly, and powerful language. In this tutorial, you’ll explore some of Python’s most used pieces of syntactic sugar.
In practice, you already use most of these pieces of syntax, as they include many well-known Pythonic constructs. As you read on, you’ll see how Python works under the hood and learn how to use the language efficiently and securely.
In this tutorial, you’ll learn:
- What syntactic sugar is
- How syntactic sugar applies to operators
- How assignment expressions are syntactic sugar
- How
for
loops and comprehensions are syntactic sugar - How other Python constructs