The Real Python Podcast cover image

Common Python Stumbling Blocks & Quirky Behaviors

The Real Python Podcast

00:00

Python's Tuple Behavior

In Python, a common way of writing is to use that sort of rooftop looking carrot symbol. It's in fact the bitwise or operator in Python. And so that could bite you again, if you're not familiar with it and definitely looks odd to a lot of people when you see it kind of appear there. One that has always been a favorite trick of many people that I know, teaching Python or showing Python stupid tricks up on something like Twitter or whatever, as this tuples behavior. If you have two values, a and b, unless you’ve already assigned them, you can write out to swap the two of them,. You can do it in a single line,

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