On Fri, Aug 2, 2013 at 1:10 PM, Nick Coghlan <ncoghlan at 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. -- ,,,^..^,,,
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4