Python Bytes cover image

#250 skorch your scikit-learn together with PyTorch

Python Bytes

00:00

Is It Better to Use a Conditional Expression in Python?

The ternary operators are pretty cool, and they're pretty easy to read in python. But i was just curious what you thought ister expression, easier to read or more difficult? Well, for me, i think this is pretty nice. I'm always on the edge about the ternary condition, the value, if condition else other value. A lot of times it starts to stretch out to be a little bit verbos and then it's not entirely obvious. Maybe maybe use a conditional expression instead and do all in one line,. like, say, in one eny examples in the blog post, says, x equals four, if condition, else five.

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