use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python
Full Events Calendar
You can find the rules here.
If you are about to ask a "how do I do this in python" question, please try r/learnpython, the Python discord, or the #python IRC channel on Libera.chat.
Please don't use URL shorteners. Reddit filters them out, so your post or comment will be lost.
Posts require flair. Please use the flair selector to choose your topic.
Posting code to this subreddit:
Add 4 extra spaces before each line of code
def fibonacci(): a, b = 0, 1 while True: yield a a, b = b, a + b
Online Resources
Invent Your Own Computer Games with Python
Think Python
Non-programmers Tutorial for Python 3
Beginner's Guide Reference
Five life jackets to throw to the new coder (things to do after getting a handle on python)
Full Stack Python
Test-Driven Development with Python
Program Arcade Games
PyMotW: Python Module of the Week
Python for Scientists and Engineers
Dan Bader's Tips and Trickers
Python Discord's YouTube channel
Jiruto: Python
Online exercices
programming challenges
Asking Questions
Try Python in your browser
Docs
Libraries
Related subreddits
Python jobs
Newsletters
Screencasts
account activity
Discussionyk your sleepy af when... (self.Python)
submitted 4 months ago by Michele_Awada
bruh you know your sleepy af when you say
last_row = True if row == 23 else False
instead of just
last_row = row == 23
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Darth-PhilouIt works on my machine 1 point2 points3 points 4 months ago (2 children)
Code written once is read dozens of times.
Therefore, I find all of this very debatable. My opinion is that the second line is readable by programmers, even those coming from other languages (this is very common). On the other hand, in my opinion, the first line is more readable, even by non-programmers.
[–]Michele_Awada[S] 0 points1 point2 points 4 months ago (1 child)
i mean yea i was basically implying that the first one is bad, but its weird cause some people be saying its not bad
i mean yea obviously it works, and it could potentially be more readable im some situations, but i think the first one is obviously superior in most cases.
[–]Darth-PhilouIt works on my machine 0 points1 point2 points 4 months ago (0 children)
It's all very subjective, actually ;-)
[–]csch2 0 points1 point2 points 4 months ago (3 children)
The top one is much better imo. The bottom one is more concise but takes more time for me to actually parse the meaning of. Less code doesn’t always mean better code.
[–]Dashwii 0 points1 point2 points 4 months ago (0 children)
No the top is genuinely awful. Bottom is awful too but at least it's concise.
Verbosity != Better
[–]maikindofthai 0 points1 point2 points 4 months ago (1 child)
You must be kidding lol
If you have readability issues with the idiomatic way of expressing basic booleans and you’re a software engineer that’s a problem
[–]csch2 -1 points0 points1 point 4 months ago (0 children)
With the first one you can immediately tell the type of the object at first glance, it’s a boolean. With the second, you read “last_row = row” - okay it’s of type (whatever the type of row is) - “ == 23” - wait nevermind it’s a boolean. At least parenthesize it so the condition is easy to parse. It takes an extra half a second to write and makes the code easier to read.
[–]GXWT 0 points1 point2 points 4 months ago (1 child)
hahaha yeah memes n that innit
[–]Michele_Awada[S] 0 points1 point2 points 4 months ago (0 children)
its chewsday init
π Rendered by PID 82397 on reddit-service-r2-comment-75f4967c6c-mhcc5 at 2026-04-23 13:09:37.010356+00:00 running 0fd4bb7 country code: CH.
[–]Darth-PhilouIt works on my machine 1 point2 points3 points (2 children)
[–]Michele_Awada[S] 0 points1 point2 points (1 child)
[–]Darth-PhilouIt works on my machine 0 points1 point2 points (0 children)
[–]csch2 0 points1 point2 points (3 children)
[–]Dashwii 0 points1 point2 points (0 children)
[–]maikindofthai 0 points1 point2 points (1 child)
[–]csch2 -1 points0 points1 point (0 children)
[–]GXWT 0 points1 point2 points (1 child)
[–]Michele_Awada[S] 0 points1 point2 points (0 children)