Thanks,
Philippe
Peter Hansen wrote:
> Philippe C. Martin wrote:
>> I guess my slicing was wrong, l[-1] worked
>
> Note that that's _not_ a slice, however, but a reference to the last
> element in the list.
>
> You'd have to subclass list to be able to do something with
> "reference-slices".
Philippe C. Martin wrote:
> I guess my slicing was wrong, l[-1] worked
Note that that's _not_ a slice, however, but a reference to the last
element in the list.
You'd have to subclass list to be able to do something with
"reference-slices". Probably returning a special object from
__getslice_
I guess my slicing was wrong, l[-1] worked
Regards,
Philippe
--
http://mail.python.org/mailman/listinfo/python-list
Thanks, I though it was a reference (tough to implement I'm sure)
Regards,
Philippe
Peter Hansen wrote:
> Philippe C. Martin wrote:
>> l = ['ABCDE','FGHI']
>
> Okay so far...
>
>> l[1:] #returns ['FGHI']
>
> Which is a _copy_ (via slicing) of part of the list. Another way of
> saying this
Philippe C. Martin wrote:
> l = ['ABCDE','FGHI']
Okay so far...
> l[1:] #returns ['FGHI']
Which is a _copy_ (via slicing) of part of the list. Another way of
saying this is that it is a _new_ list which has a copy of the
references from the appropriate part of the old list.
Try "l[1:] is l[1
Hi,
I have the following question:
l = ['ABCDE','FGHI']
l[1:] #returns ['FGHI']
l[1:][0] #return 'FGHI'
a = l[1:][0] + 'J' #a becomes 'FGHIJ'
l[1:][0] += 'J' #NO ERROR BUT l[1:][0] == 'FGHI'
What am I missing ?
Thanks,
Philippe
--
http://mail.python.org/mailman/listinfo/python-list