[Tutor] weird lambda expression -- can someone help me understand how this works

spir denis.spir at gmail.com
Sat Dec 14 15:59:01 CET 2013


On 12/14/2013 12:37 PM, Alan Gauld wrote:
> I must admit I'd never even thought of checking the __name__ attribute
> of a lambda, I'd kind of just assumed it would be empty (or maybe 'anonymous')!

You are right, Alan, in my view.
	any_lambda_func.__name__ == "<anonymous>"
would be a better choice. (And in that case, shortcut imprecise human language 
--which is just natural and to be expected-- could not end up saying things that 
a lambda's name is lambda [or things that can be interpreted that way when not 
fully attentive, which is also natural and to be expected].)

Denis


More information about the Tutor mailing list