Composition of functions

Terry Reedy tjreedy at udel.edu
Thu Jul 1 21:18:49 EDT 2010


On 7/1/2010 3:54 AM, Stephen Hansen wrote:
> On 7/1/10 12:45 AM, Terry Reedy wrote:
>> On 7/1/2010 12:32 AM, Mladen Gogala wrote:
>>> On Wed, 30 Jun 2010 21:04:28 -0700, Stephen Hansen wrote:
>>
>>>> However, you can easily get what you want by using the 'reversed'
>>>> function (and similarly, the 'sorted' function), a la:
>>>>
>>>> >>> y = ''.join(reversed(list(x)))
>>>>
>>>> The 'reversed' and 'sorted' functions are generators that lazilly
>>>> convert an iterable as needed.
>>>
>>> Ah, that is even better. Thanks.
>>
>> It is better if you do not mind making an unnecessary copy. If the list
>> had 10 million elements, you might prefer your original.
>
> The original that did not work? :)

The revised original that did work with sequential statements.



-- 
Terry Jan Reedy




More information about the Python-list mailing list