Haskell like (c:cs) syntax
Ricardo Aráoz
ricaraoz at gmail.com
Wed Aug 29 08:12:19 EDT 2007
Marco Mariani wrote:
> Ricardo Aráoz ha scritto:
>
>> L = ['one', 'two', 'three', 'four', 'five']
>>
>> print L[0] # This would be 'head'
>> print L[1:] # This would be 'tail'
>>
>> Caution : L[0] and L[1:] are COPIES of the head and tail of the list.
>
> This might surprise people who see L[1:] = [], since changing a copy is
> not supposed to change the original.
>
Sorry, should have written RETURN copies instead of ARE copies.
More information about the Python-list
mailing list