a = b = 1 just syntactic sugar?

Nielson Family junk at geekabytes.net
Tue Jun 10 16:45:46 CEST 2003


Terry,

I'm flattered you think my hack is  'clever' ;)

I am curious... don't you think that using the name that an anonymous 
function is assigned to within the anonymous function breaks the concept 
of an anonymous function?

-- Seth

Terry Reedy wrote:

>"Steven Taschuk" <staschuk at telusplanet.net> wrote in message
>news:mailman.1055177098.5381.python-list at python.org...
>  
>
>>    factorial = lambda x: x==0 and 1 or x*selfref.myself(x-1)
>>    
>>
>
>If the lambda is immediately name bound, the selfref contortion is not
>needed:
>
>  
>
>>>>factorial = lambda x: x==0 and 1 or x*factorial(x-1)
>>>>factorial(6)
>>>>        
>>>>
>720
>
>but it is a clever hack for when it is not.
>
>Terry J. Reedy
>
>
>  
>







More information about the Python-list mailing list