> I guess that's inevitable (given lambda's existence... and human > nature;-) and about on the same plane as another hatefully redundant > construct I find myself having to beat upon over and over in code > reviews: > > if <expression>: > result = True > else: > result = False > return result > > vs the simple "return <expression>" [[or bool(<expression>) if it's > actually mandatory to return a bool and <expression> can't be relied > upon to produce one]]. Indeed, I think these are the same phenomenons. If lambdas where not available, people would, instead of writing Thread(target = lambda: foo()) write def target(): foo() Thread(target = target) Your example above demonstrates that the boolean type is a concept that is *very* difficult to grasp (not the notion of boolean expressions, which are easy to understand - it's the boolean *type* that is difficult, i.e. that a boolean expression can be used not just in conditional statements, but also assigned to variables, returned, etc.). When I ask students in the exam to rewrite your code above (and assuming they use Java), so that "it is a single line", they typically write return <expression> ? true : false; Likewise, apparently, the notion of generic callables is difficult to understand. Unless you have written it yourself, you won't recognize an expression as callable. Regards, Martin
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