Question about Pass-by-object-reference?
emile
emile at fenx.com
Tue Jul 22 18:33:10 EDT 2014
On 07/22/2014 03:17 PM, fl wrote:
> On Tuesday, July 22, 2014 4:46:25 PM UTC-4, emile wrote:
>> On 07/22/2014 01:35 PM, Peter Pearson wrote:
>> def reassign(mylist): # no reason to shadow the list builtin
>> mylist[:] = [0,1]
>> mylist = [1]
>> reassign(mylist)
>> mylist
>> Emile
>
> Thanks for your example. I do not find the explanation of [:] on line.
It's covered in the tutorial in
https://docs.python.org/2/tutorial/introduction.html
look for the section on slice notation
> Could you explain it to me, or where can I find it on line?
If you haven't already, you should work your way through the full
tutorial if for no other reason that to be familiar with content others
find beginners should be introduced to.
https://docs.python.org/2/tutorial/index.html
Emile
More information about the Python-list
mailing list