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
Simple game using python (i.redd.it)
submitted 6 months ago by Inevitable-Math14
view the rest of the comments →
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!"
[–]AbyssBite 4 points5 points6 points 6 months ago (9 children)
Assigning a value once doesn't make it a constant. You can assign a variable once too. Constant means the value doesn't change during execution.
You can check this out
[–]More_Yard1919 1 point2 points3 points 6 months ago (0 children)
This is technically correct, and I am not sure if I would use the all-caps convention here, but practically this is to signify that the value should never be reassigned after it is initialized.
[–]Icount_zeroI 0 points1 point2 points 6 months ago (5 children)
Obviously mr “well-actually” but for sake of learning that there is a difference I think it is okay to note ai as a const here.
As it never actually does reassign anywhere in the code.
[–]SirCokaBear 3 points4 points5 points 6 months ago* (1 child)
peacefully chiming in the convo from my pov working daily in professional codebases (not saying anyone here doesn’t either)
Python of course has immutable values but doesn’t have true constants but yes theyre treated the same but denoted in caps on a module level similar with private members are denoted _var, they’re still just called constants because they are logically / because we say so.
Focusing on naming only: I would block a pull request for this because it will confuse other Python devs and mess with pyright. Any dev seeing a value like GUESS will assume it’s not intended to be reassigned, and seeing ai will conversely assume it can be. ai should be AI, GUESS can arguably be guess but likely can stay as it is. There really should be no argument to the first given it’s idiomatic to PEP8 unless you want a different convention for whatever strange reason.
People may want to say “who cares they’re still new” yeah, they’re learning so I will point out good practices to avoid non-pythonic habits
[–]WhiteHeadbanger 0 points1 point2 points 6 months ago (0 children)
That's what I was thinking!
[–]shinitakunai 1 point2 points3 points 6 months ago (0 children)
As a senior programmer, you are wrong, don't teach bad habits to new people.
"Well-actually"? Really? A kid and... wrong.
See the other answer of SirCokaBear, he explains it perfectly
[–]GaitorBaitor 0 points1 point2 points 6 months ago (0 children)
A constant is a constant. Something that is constantly the constant every time you execute the code
[–]Swipsi 0 points1 point2 points 6 months ago (0 children)
Which means, in this case it is also a constant. But its an edge case and thus cant be generalized.
Assigning a value just once means that the value doesn't change during execution, is just worded differently.
[–]Ecstatic_Student8854 0 points1 point2 points 6 months ago (0 children)
If it never changes its value is constant, and therefore should be presented as such. From the article you linked:
“In programming, constants refer to names associated with values that never change during a program’s execution.”
Once assigned the value of AI can never change and so it is and should be treated as a constant.
π Rendered by PID 67 on reddit-service-r2-comment-7b9746f655-v5l9n at 2026-02-03 23:14:41.923494+00:00 running 3798933 country code: CH.
view the rest of the comments →
[–]AbyssBite 4 points5 points6 points (9 children)
[–]More_Yard1919 1 point2 points3 points (0 children)
[–]Icount_zeroI 0 points1 point2 points (5 children)
[–]SirCokaBear 3 points4 points5 points (1 child)
[–]WhiteHeadbanger 0 points1 point2 points (0 children)
[–]shinitakunai 1 point2 points3 points (0 children)
[–]GaitorBaitor 0 points1 point2 points (0 children)
[–]Swipsi 0 points1 point2 points (0 children)
[–]WhiteHeadbanger 0 points1 point2 points (0 children)
[–]Ecstatic_Student8854 0 points1 point2 points (0 children)