[EMAIL PROTECTED] wrote:
> Quoting Kent Johnson <[EMAIL PROTECTED]>:
> 
> 
>>J. Gabriel Schenz wrote:
>>
>>>Now, I am new to Python as well, but it seems like apply might not be
>>>completely superfluous. I was thinking that if one were using a functional
>>>programming style, and had to apply a function determined at runtime to an
>>>argument, then one could use this apply to do so. 
>>
>>apply() is superfluous. apply(function, args[, keywords]) is exactly
>>equivalent to function(*args, [**keywords]). 
> 
> 
> Ooh.  Functional programming is fun!
> 
> 
>>>>multers = [i.__mul__ for i in range(10)]
>>>>mulTable = [[f(i) for i in range(10)] for f in multers]

or use mulTable = [[i*j for i in range(10)] for j in range(10)] if you prefer 
conciseness and 
readability :-)

Kent

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to