Can Python function return multiple data?

Marko Rauhamaa marko at pacujo.net
Thu Jun 4 10:25:46 EDT 2015


Steven D'Aprano <steve at pearwood.info>:

> But you still find a few people here and there who have been exposed
> to Java foolishness, and will argue that Python is "pass by value,
> where the value is an implementation dependent reference to the thing
> that you thought was the value".

Why fight terminology? Definitions can't be proved right or wrong.

Anyway, I would say Python definitely is in the classic pass-by-value
camp. Here's a simple test:

   def f(x):
       x = 3

   y = 1
   f(y)
   print(y)

If it prints 1, it's pass by value. If it prints 3, it's pass by
reference.


Marko



More information about the Python-list mailing list