[newbie] A question about lists and strings

Roman Vashkevich vashkevichrb at gmail.com
Fri Aug 10 07:06:14 EDT 2012


10.08.2012, в 14:12, Mok-Kong Shen написал(а):

> Am 10.08.2012 11:48, schrieb Roman Vashkevich:
>> [snip]
> >The function .... It takes list by reference and creates a new local
> > str. When it's called with listb and strb arguments, listb is passed
> > by reference and mutated. A string "sss" is concatenated with an
> > empty local str. Nothing more happens. Since local str is not
> > returned by xx(), it can not be expected to be printed out in the
> > statement that follows. What is printed out in the print statement is
> > the mutated listb and the global strb.
> 
> Thanks for the explanation of the output obtained. But this means
> nonetheless that parameters of types lists and strings are dealt with
> in "inherently" (semantically) different ways by Python, right?
> 
> M. K. Shen
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list

DaveA provided a very explicit explanation of how py handles list and string objects.
Parameters are handled "inherently" by functions...

RV


More information about the Python-list mailing list