A question on modification of a list via a function invocation

Ned Batchelder ned at nedbatchelder.com
Wed Aug 16 20:14:01 EDT 2017


On Thu, Aug 17, 2017 at 8:29 AM, Mok-Kong Shen wrote:
>  Anyway, while
> any new user of a programming language certainly can be expected to
> take good efforts to learn a lot of new stuffs, I suppose it's good
> for any practical programming language to minimize the cases of
> surprises for those that come from other programming languages.
Which other languages? Should Python's functions act like C functions,
or like Haskell functions?  Should Python's strings act like C strings,
or Ruby strings? Should Python's syntax be like C syntax, or like Lisp
syntax? If languages can't be different from each other, then there's no
point in having different languages.  I agree that gratuitous
differences are, well, gratuitous, but the name/value data model of
Python is not some trivial detail that we could change to match some
other language: it's a fundamental part of what makes Python what it is.

For some reason, students have been taught that things can be either
call-by-reference or call-by-value. But those are not the only two
possibilities, and neither completely describes how Python works.

Learn Python for what it is.

--Ned.




More information about the Python-list mailing list