Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm not sure I understand. Function calls work the same way in every call by value language: the binding of an argument to a value is the same as the binding of a variable or the assignment of part of a data structure. That's a pretty clear and simple thing to want to say, and "call by value" is the way to say it.

Since this is exactly the behaviour of Python's function calls, how is describing Python as call by value "not useful"? And where's this "misleading analogy to another language", given the concept is clearly explained without reference to any particular language?

I'm prepared to accept that people become confused over this, but I reject the notion that it is not a useful question.



People ask these questions because they're used to the way other languages work, and want to have an analogy to help them understand how Python works.

Except this isn't useful, because Python doesn't work the way those other languages do. They'll run into cases where their mental model of what "pass-by-value" or "pass-by-reference" means does not match up to Python's actual workings, and then they'll spend endless time arguing about which model Python uses when the answer is really "neither, stop trying to shoehorn one of those models onto a language that doesn't fit".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: