very good reasons?
Alex Martelli
aleaxit at yahoo.com
Fri Oct 13 06:13:53 EDT 2000
"Samuel A. Falvo II" <kc5tja at garnet.armored.net> wrote in message
news:slrn8ucb9e.eam.kc5tja at garnet.armored.net...
[snip]
> Python does. In my ideal system, I'd use:
>
> sorted = array.inAscendingOrder(); foo( sorted )
>
> or:
>
> sorted = array.inSortedOrderBy( compare_function ); foo( sorted )
>
> This, to me, makes much more sense and is more explicit. This
disadvantage
> is that this consumes more memory in the process.
It's easy to build your "ideal system"'s functionality in terms
of what Python offers today, except for the syntactic-sugar
detail of having it appear as a function-call rather than as
a method-call:
def inAscendingOrder(sequence):
result = list(sequence)
result.sort()
return result
sorted = inAscendingOrder(array); foo(sorted)
and so on.
Alex
More information about the Python-list
mailing list