this post was submitted on 24 Apr 2025
1 points (100.0% liked)

Python

7869 readers
1 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

πŸ“… Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
πŸ’“ Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] Ephera@lemmy.ml 0 points 11 months ago (1 children)

You always want explicitness when programming. Not everyone reading your code will be deep into Python and relying on falsiness makes it harder to understand.

[–] fruitcantfly@programming.dev 0 points 11 months ago (1 children)

Containers being "truthy" is quite basic Python and you will find this idiom used in nearly every Python code base in my experience

[–] Ephera@lemmy.ml 0 points 11 months ago* (last edited 11 months ago) (1 children)

Yeah, I'm talking less deep than that. Plenty programming beginners will be reading Python code. And personally, I'm a fulltime software engineer, but just don't do much Python, so while I had it in the back of my mind that Python does truthiness, I would have still thought that var must be a boolean, because it's being negated. Obviously, a different variable name might've given me more of a clue, but it really doesn't reduce mental complexity when I can't be sure what's actually in a variable.

[–] fruitcantfly@programming.dev 0 points 11 months ago* (last edited 11 months ago)

But if those beginners want to stop being beginners, then they must learn the basics of the language. It makes no more sense to demand that everyone who programs in Python caters to beginners, than it makes to demand that everyone writing in English write at a 3rd grade reading level for the sake of English language learners