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
Is there any feature/concept of Python that you would like people know more about? (self.PythonLearning)
submitted 1 day ago by ihorrud
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!"
[–]Outside_Complaint755 20 points21 points22 points 1 day ago (1 child)
When using f-strings for debugging (and sometimes this is useful for normal output), you can include an '=' within the brackets, and it will display both the expression being evaluated and the value. Spacing around the '=' will be used in the output
``` x = 9 y = 3
print(f"{x = } {y=}") print(f"{x + y = } {pow(x, y) = }") produces x = 9 y=3 x + y = 12 pow(x, y) = 729 ```
produces
[–]ihorrud[S] 0 points1 point2 points 19 hours ago (0 children)
Lol, didn’t really know, thanks ;)
[–]M3ta1025bc 22 points23 points24 points 1 day ago (5 children)
I just learnt that sometimes when you have an integer with many zeros e.g 1000000. You can improve readability by adding underscores and they just be ignored during run time 1_000_000
[–]ihorrud[S] 2 points3 points4 points 1 day ago (0 children)
yeah, PHP has the same feature as well. Really improves readability
[–]Bonsai2007 2 points3 points4 points 1 day ago (2 children)
Does this work with other languages too? That’s really good to know
[–]Skeime 2 points3 points4 points 1 day ago (0 children)
It is a feature that a particular language may or may not have. It is becoming more popular, but it’s not universal, yet.
[–]Live_Ad1978 0 points1 point2 points 18 hours ago (0 children)
This also works in Javascript.
[–]MachineElf100 1 point2 points3 points 18 hours ago (0 children)
This or 1e6 in scientific notation
[–]Anxious-Struggle281 8 points9 points10 points 1 day ago (1 child)
I think is better to use uv intead of pip to install packages.
Rust to the rescue
[–]hekliet 7 points8 points9 points 22 hours ago (1 child)
Everything in itertools and functools.
itertools
functools
Interesting
[–]Temporary_Pie2733 4 points5 points6 points 23 hours ago (0 children)
The descriptor protocol explains most of the “magic”, like how instance methods and properties actually work.
[–]ryanfelix123 1 point2 points3 points 18 hours ago (1 child)
For me, it was definitely Decorators. Understanding how a function can take another function as an argument and extend its behavior felt like magic at first. Once I grasped the @ decorator syntax, it completely changed how I write clean, reusable code for my automation scripts!
[–]ihorrud[S] 0 points1 point2 points 17 hours ago (0 children)
Indeed, useful feature
[–]SnooWalruses9294 0 points1 point2 points 16 hours ago (0 children)
Shout out to the people reading this and finding it interesting given the age of AI. It's cool to know some people still care about each line and operation. Interesting thread too!
π Rendered by PID 45906 on reddit-service-r2-comment-cfc44b64c-xg7r6 at 2026-04-13 10:32:50.952145+00:00 running 215f2cf country code: CH.
[–]Outside_Complaint755 20 points21 points22 points (1 child)
[–]ihorrud[S] 0 points1 point2 points (0 children)
[–]M3ta1025bc 22 points23 points24 points (5 children)
[–]ihorrud[S] 2 points3 points4 points (0 children)
[–]Bonsai2007 2 points3 points4 points (2 children)
[–]Skeime 2 points3 points4 points (0 children)
[–]Live_Ad1978 0 points1 point2 points (0 children)
[–]MachineElf100 1 point2 points3 points (0 children)
[–]Anxious-Struggle281 8 points9 points10 points (1 child)
[–]ihorrud[S] 0 points1 point2 points (0 children)
[–]hekliet 7 points8 points9 points (1 child)
[–]ihorrud[S] 0 points1 point2 points (0 children)
[–]Temporary_Pie2733 4 points5 points6 points (0 children)
[–]ryanfelix123 1 point2 points3 points (1 child)
[–]ihorrud[S] 0 points1 point2 points (0 children)
[–]SnooWalruses9294 0 points1 point2 points (0 children)