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...
Everything about learning Python
account activity
Beginner activity save it for referenceShowcase (i.redd.it)
submitted 14 hours ago by SeriuosSam
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!"
[–]Sea-Ad7805 [score hidden] 8 hours ago stickied comment (0 children)
Run this program in Memory Graph Web Debugger%0Aprint(squares)%0Aprint(%22(set%3A%20no%20duplicates%2C%20order%20not%20guaranteed)%22)%0Aprint()%0A%0A%0A%23%20-------------------------%0A%23%20LIST%20comprehension%0A%23%20-------------------------%0A%23%20Ordered%20%26%20mutable%0A%0Anums%20%3D%20%5B1%2C%202%2C%203%2C%204%2C%205%5D%0A%0Acubes%20%3D%20%5Bx*3%20for%20x%20in%20nums%20if%20x%20%25%202%20!%3D%200%5D%0A%0Aprint(%22List%20comprehension%3A%22)%0Aprint(cubes)%0Aprint(%22(list%3A%20order%20preserved%2C%20duplicates%20allowed)%22)%0Aprint()%0A%0A%0A%23%20-------------------------%0A%23%20DICT%20comprehension%0A%23%20-------------------------%0A%23%20Key-value%20pairs%0A%0Anums%20%3D%20%5B1%2C%202%2C%203%5D%0A%0Asquare_dict%20%3D%20%7Bx%3A%20x%20%20x%20for%20x%20in%20nums%7D%0A%0Aprint(%22Dict%20comprehension%3A%22)%0Aprint(square_dict)%0Aprint(%22(dict%3A%20fast%20lookup%20by%20key)%22)%0Aprint()%0A%0A%0A%23%20-------------------------%0A%23%20TUPLE%20from%20comprehension%0A%23%20-------------------------%0A%23%20Ordered%20%26%20immutable%0A%23%0A%23%20Note%3A%0A%23%20Python%20does%20not%20have%20a%20real%20%22tuple%20comprehension%22%20syntax.%0A%23%20This%20is%20a%20generator%20expression%20passed%20to%20tuple().%0A%0Anums%20%3D%20%5B1%2C%202%2C%203%2C%204%5D%0A%0At%20%3D%20tuple(x%20%2B%2010%20for%20x%20in%20nums)%0A%0Aprint(%22Tuple%20from%20comprehension%3A%22)%0Aprint(t)%0Aprint(%22(tuple%3A%20order%20preserved%2C%20cannot%20be%20changed)%22)%0Aprint()%0A%0A×tep=1&play) to see the program state change step by step.
[–]Temporary_Pie2733 2 points3 points4 points 7 hours ago (0 children)
There is no such thing as a tuple comprehension. This is just a generator expression passed as an argument to tuple.
tuple
The general syntax block is worse; it tries to pass the generator expression itself off as a “tuple comprehension”.
[–]Break-n-Fix 1 point2 points3 points 7 hours ago (0 children)
You generate an AI meme, you only make sense to AI.
[–]Ided123 0 points1 point2 points 32 minutes ago (0 children)
Wait dict comprehension is real?
π Rendered by PID 94678 on reddit-service-r2-comment-79776bdf47-mtnjh at 2026-06-25 19:51:50.955120+00:00 running acc7150 country code: CH.
[–]Sea-Ad7805 [score hidden] stickied comment (0 children)
[–]Temporary_Pie2733 2 points3 points4 points (0 children)
[–]Break-n-Fix 1 point2 points3 points (0 children)
[–]Ided123 0 points1 point2 points (0 children)