Dick Moores wrote:
> At 01:37 PM 9/30/2006, Shantanoo Mahajan wrote:
>
>> Maybe following is helpful:
>>
>>
> a=[3,2,1]
> b=a[:]
> b.sort()
> c=sorted(a)
> print a,b,c
> [3, 2, 1] [1, 2, 3] [1, 2, 3]
>
>
>> Shantanoo
>>
>
> Sorry to be dense,
At 01:37 PM 9/30/2006, Shantanoo Mahajan wrote:
>Maybe following is helpful:
>
> >>> a=[3,2,1]
> >>> b=a[:]
> >>> b.sort()
> >>> c=sorted(a)
> >>> print a,b,c
> >>> [3, 2, 1] [1, 2, 3] [1, 2, 3]
> >>>
>
>Shantanoo
Sorry to be dense, but I don't see what showing what happens to a
copy of list a ad
+++ Dick Moores [30-09-06 10:47 -0700]:
| At 05:07 AM 9/30/2006, Liam Clarke wrote:
| >Dick Moores wrote:
| > > At 03:22 AM 9/30/2006, Liam Clarke wrote:
| > >> Dick Moores wrote:
|
| > >> A Python list sort is destructive, as you can see - it has modified
| > >> lst. So, to emphasise that it is d
At 05:07 AM 9/30/2006, Liam Clarke wrote:
>Dick Moores wrote:
> > At 03:22 AM 9/30/2006, Liam Clarke wrote:
> >> Dick Moores wrote:
> >> A Python list sort is destructive, as you can see - it has modified
> >> lst. So, to emphasise that it is destructive, it returns None. You'll
> >> find this in
Dick Moores wrote:
> At 03:22 AM 9/30/2006, Liam Clarke wrote:
>> Dick Moores wrote:
>>>
>>> >>> lst = [5,3,7,6,2]
>>> >>> lst.sort()
>>> >>> lst
>>> [2, 3, 5, 6, 7]
>>> >>> lst = [5,3,7,6,2]
>>> >>> print lst.sort()
>>> None
>>> >>> lst
>>> [2, 3, 5, 6, 7]
>>>
>>> I'm wondering why "print ls
Dick Moores wrote:
> At 03:22 AM 9/30/2006, Liam Clarke wrote:
>> Dick Moores wrote:
>>>
>>> >>> lst = [5,3,7,6,2]
>>> >>> lst.sort()
>>> >>> lst
>>> [2, 3, 5, 6, 7]
>>> >>> lst = [5,3,7,6,2]
>>> >>> print lst.sort()
>>> None
>>> >>> lst
>>> [2, 3, 5, 6, 7]
>>>
>>> I'm wondering why "print ls
At 03:22 AM 9/30/2006, Liam Clarke wrote:
Dick Moores wrote:
>>> lst = [5,3,7,6,2]
>>> lst.sort()
>>> lst
[2, 3, 5, 6, 7]
>>> lst = [5,3,7,6,2]
>>> print lst.sort()
None
>>> lst
[2, 3, 5, 6, 7]
I'm wondering why "print lst.sort()" doesn't print the newly
sorted
list, but instead prints
Dick Moores wrote:
>>> lst = [5,3,7,6,2]
>>> lst.sort()
>>> lst
[2, 3, 5, 6, 7]
>>> lst = [5,3,7,6,2]
>>> print lst.sort()
None
>>> lst
[2, 3, 5, 6, 7]
I'm wondering why "print lst.sort()" doesn't print the newly sorted
list, but instead prints "None". In fact, the sorting has taken
>>> lst = [5,3,7,6,2]
>>> lst.sort()
>>> lst
[2, 3, 5, 6, 7]
>>> lst = [5,3,7,6,2]
>>> print lst.sort()
None
>>> lst
[2, 3, 5, 6, 7]
I'm wondering why "print lst.sort()" doesn't print the newly sorted
list, but instead prints "None". In fact, the sorting has taken place
because of "print l