On Monday, September 4, 2017 at 5:58:18 PM UTC+5:30, ROGER GRAYDON CHRISTMAN wrote: > >Does a poor job AFAIAC of explaining the difference between foo and bar in > foll>>>> def foo(x): x += 2 > >>>> def bar(x): x.append(2) > >>>> a=10 > >>>> b=[10] > >>>> foo(a) > >>>> a > >10 > >>>> bar(b) > >>>> b > >[10, 2] > >>>> > Or with just one function: >>> def baz(x,y): > x += y > >>> a = 10 > >>> b = [10] > >>> baz(a,a) > >>> a > 10 > >>> baz(b,b) > >>> b[10, 10]
Ha Ha! Lovely [I was about to ask Chris if he is being serious about relating this to the presence of '=' ] However if you desugar the += into __iadd__ then someone may argue the presence of the = is an optical illusion -- https://mail.python.org/mailman/listinfo/python-list