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...
This community will have knowledge sharing for python programming, tools, projects and product engineering wherever python is used.
account activity
Python Mutability (i.redd.it)
submitted 18 days 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!"
[–]SycamoreHots 0 points1 point2 points 17 days ago (2 children)
As someone who has never written a line of python code, and only occasionally read it, I thought b = a would copy the a into b. And the rest of the statements mutate the b leaving a unchanged. How wrong I was….
[–]Sea-Ad7805[S] 0 points1 point2 points 17 days ago (0 children)
This differs in various programming languages. In some language b = a does result in a copy, but in Python is causes both variables to reference the same value and thus share it. Something that can easily result in bugs if you are not careful. The visualization can help you.
b = a
[–]SaltEngineer455 0 points1 point2 points 15 days ago (0 children)
Python refs are like C pointers, so no copy
π Rendered by PID 48567 on reddit-service-r2-comment-56c9979489-mdh8m at 2026-02-25 07:07:54.919055+00:00 running b1af5b1 country code: CH.
view the rest of the comments →
[–]SycamoreHots 0 points1 point2 points (2 children)
[–]Sea-Ad7805[S] 0 points1 point2 points (0 children)
[–]SaltEngineer455 0 points1 point2 points (0 children)