On 05/06/2015 01:16, BartC wrote:
On 05/06/2015 00:13, Steven D'Aprano wrote:
On Fri, 5 Jun 2015 06:52 am, BartC wrote:

On 04/06/2015 18:11, Steven D'Aprano wrote:

If there is
any language where assignment uses one style and argument passing
always
uses another, I've never come across it.

My language does that. I'd be very surprised if it was the only one in
existence that does so.

I would be. That means that

func(x)

and

tmp = x
func(tmp)

behave differently,

Not as far as func() is concerned. But overall there is a difference
because now tmp contains a copy of x. (Also, if x contains a list for
example, func() can modify the copy in tmp, not in x. But this shouldn't
be surprised because the code is different!)


Really?

>>> x=[1,2,3]
>>> tmp=x
>>> def func(thing):
...     thing.clear()
...
>>> func(tmp)
>>> tmp
[]
>>> x
[]

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to