On Fri, Aug 2, 2013 at 1:10 PM, Nick Coghlan <ncogh...@gmail.com> wrote: > Lambda was almost removed in Python 3. > >> >> Using `dict` to store lambdas: >> >> > op = { 'add': lambda x,y: x*y, 'mul': lambda x, y: x+y} >> >> Shows the hack to bypass PEP8 guides. Do you like to see code above >> instead of: >> >> add = lambda x,y: x*y >> mul = lambda x, y: x+y >> >> Probably, I don't since dict is a blackbox and I have to check things >> first before use them. > > People are free to write their own style guides that disagree with pep 8 (a > point which is now made explicitly in the PEP). > >> >> Disclaimer: I don't try to stand for lambdas, I'm not using them >> everywhere in my code, but I'd like to know answer for the question >> "Why lambdas?". Currently, it is "Handy shorthand functions - use them >> free", but with new PEP-8 statement I really have to think like >> "Lambdas? Really, why?". > > Use them for an anonymous function as an expression. All PEP 8 is now saying > is that giving a lambda a name is to completely misunderstand what they're > for. > > Cheers, > Nick.
Thanks for explanations, Nick, I'd got the point. -- ,,,^..^,,, _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com