On 2015-06-04, Marko Rauhamaa <ma...@pacujo.net> wrote: > Steven D'Aprano <st...@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.
Somebody else might just as honestly say that it's pass by reference: def f(x): x[2] = 2; x = ['a','b','c'] f(x) print(x) If it prints ['a','b','c'], it's pass by value. If it's pass by reference, it prints ['a', 'b', 2]. IMO, it's pass by reference. But, discussing pass-by-this vs. pass-by-that without also discussing the semantics of the assignment operator is rather pointless. Not that the pointlessness of an argument is going to slow down a thread... -- Grant Edwards grant.b.edwards Yow! I request a weekend in at Havana with Phil Silvers! gmail.com -- https://mail.python.org/mailman/listinfo/python-list