4 ms·
> # Python is pass-by-reference, what are the > # implications of sorted() vs numbers.sort()? I thought references were passed by value in languages like Pyth
by hirvi74 4mo ago
> # Python is pass-by-reference, what are the
> # implications of sorted() vs numbers.sort()?
I thought references were passed by value in languages like Python? I am not particularly fond of Python, so my experience with and knowledge of the language are quite limited. But, I understand what the question is asking: mutation vs. the creation of a new object.
- minitech 4mo agoCorrect, it’s a common misconception/sloppy wording.
- AdieuToLogic 4mo agoA mental exercise I perform when "reference" is used in this context is to substitute it with "pointer." I find it clarifying and rarely, if ever, incorrect.