Gabriel Genellina a écrit :
> En Wed, 07 Mar 2007 18:48:18 -0300, Arnaud Delobelle  
> <[EMAIL PROTECTED]> escribió:
> 
>> for f in int, float, complex:
>>     try:
>>         return f(x)
>>     except ValueError:
>>         continue
>> raise CantDoIt
>>
>> But if the three things I want to do are not callable objects but
>> chunks of code this method is awkward because you have to create
>> functions simply in order to be able to loop over them (this is whay I
>> was talking about 'abusing loop constructs').  Besides I am not happy
>> with the other two idioms I can think of.
> 
> 
> Hmmm, functions are cheap 

To define. You pay the price when you call them !-)

(sorry, couldn't resist - I otherwise totally agree with you)

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to