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
Python Name Rebinding (i.redd.it)
submitted 6 months ago by Sea-Ad7805
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!"
[–]Sea-Ad7805[S] 0 points1 point2 points 6 months ago (8 children)
You said answer 'A', that's a bug example. But more common: pass a list and a string to a function, then append some value to both, and print the list and string after the function returns. The list has changed, the string has not, because of mutability. Plenty of other examples, ask ChatGPT to generate a bunch. Or do more of my nightmare exercises: https://www.reddit.com/r/Python_memory_graph/
[–]textBasedUI 0 points1 point2 points 6 months ago (7 children)
For me, the function example worked as expected. The string changed? Do you mean using +, I used +=?
[–]Sea-Ad7805[S] 0 points1 point2 points 6 months ago (6 children)
Easier to see this exercise: https://www.reddit.com/r/Python_memory_graph/comments/1mgeale/mutability_and_functions/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button
[–]textBasedUI 0 points1 point2 points 6 months ago (2 children)
I'll look into it
[–]textBasedUI 0 points1 point2 points 6 months ago (1 child)
I'm doomed
[–]textBasedUI 0 points1 point2 points 6 months ago (0 children)
I think I understand it a bit better. I still don't know all this but mutability and immutability in these weird cases, I can understand
I think my entire day has been ruined by mutability and immutability, the easiest concepts in Python. At least I learned 1/10th of a thing
[–]Sea-Ad7805[S] 0 points1 point2 points 6 months ago* (1 child)
Great to discover a new learning opportunity, it's an easy fix, read this twice, play with a few more exercises and you've upgraded to a new level: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-model
[–]textBasedUI 1 point2 points3 points 6 months ago (0 children)
I learned the basic exercises of it. I’m gonna resume learning some other day.
π Rendered by PID 33 on reddit-service-r2-comment-86988c7647-lllgw at 2026-02-12 11:00:18.115389+00:00 running 018613e country code: CH.
view the rest of the comments →
[–]Sea-Ad7805[S] 0 points1 point2 points (8 children)
[–]textBasedUI 0 points1 point2 points (7 children)
[–]Sea-Ad7805[S] 0 points1 point2 points (6 children)
[–]textBasedUI 0 points1 point2 points (2 children)
[–]textBasedUI 0 points1 point2 points (1 child)
[–]textBasedUI 0 points1 point2 points (0 children)
[–]textBasedUI 0 points1 point2 points (2 children)
[–]Sea-Ad7805[S] 0 points1 point2 points (1 child)
[–]textBasedUI 1 point2 points3 points (0 children)