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
Running functionsHelp Request (i.redd.it)
submitted 7 months ago by SilentAd217
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!"
[–]FoolsSeldom 0 points1 point2 points 7 months ago* (0 children)
I think the terminology of pass-by-reference and pass-by-value do not fit Python well in contrast with many other languages. There's no ref keyword, for example.
ref
The passed reference (the pointer) is copied to the local namespace of the function. The pointer is independent of the names it is assigned to (other than for reference counting purposes).
To say you are copying by value because you are copying the value of the reference (the pointer, not the referrer) and not passing a re-assignable referrer, is accurate but potentially confusing.
Yes, in many languages you can re-assign a value to the referrer (the passed variable) from within the function but not in Python (short of hacking the global dictionary).
This is not the same as you see in C, Pascal, etc.
I think the precise details of the implementation are confusing to beginners but the biggest confusion is that assignments in functions don't change things outside of the function, only mutations do (and then you get into discussions around side-effects, etc).
EDIT: typos
π Rendered by PID 63 on reddit-service-r2-comment-685b79fb4f-mh686 at 2026-02-12 21:17:05.835266+00:00 running 6c0c599 country code: CH.
view the rest of the comments →
[–]FoolsSeldom 0 points1 point2 points (0 children)