Re:Curing Python's Neglect
by brendano on Friday May 29, 2009 @09:25PM
(#633139)
For an immutable type, there's no distinction between pass-by-value and pass-by-reference. How would you ever know the difference?
[ Parent
| on HN ]
Speed? Not sure if this is actually what the OP was thinking of, but pass-by-value usually implies copying, while pass by reference just involves handing around a pointer.
ie, if you had an enormous immutable value (in Python, a tuple with lots of entries), then in a hypothetical Python implementation which did call-by-value, it might be significantly slower than call-by-reference, on account of having to copy the entire tuple.
But this falls squarely into 'implementation detail' - if you're so inclined, you could implement either CBV or CBR in hundreds of other ways. Certainly from the perspective of time-independent program behaviour you shouldn't be able to tell the difference.