Cleaning up conditionals
rustompmody at gmail.com
Sun Jan 1 09:20:47 EST 2017
On Sunday, January 1, 2017 at 3:39:14 PM UTC+5:30, Deborah Swanson wrote:
> Sorry guys. I've read all your responses and I kind of get their general
> drift, but I'm about four sheets to the wind right now, and no way would
> I make it more than a step or two in playing around with these things
> and trying to get my head around them before it would all descend into a
> cacaphony of gibberish.
Its true that in most programming languages one is likely to see,
a conditional (if) statement is likely harder to grok than a conditional
expression ie if the expression is allowed at all!!
Just as recursion is supposedly harder than repetition,
List comprehensions harder than for-loops
This is true culturally and historically but not necessarily.
>From the more conceptual viewpoint they are duals; see table at
Of course if one has grown up with assignment (and even more so the print
statement) being (imagined to be) easy and natural and obvious, this logically
unnecessary but culturally inevitable sense of difficulty will be there... unfortunately.
tl;dr Above is unlikely to help reduce the confusion. The essential ideas
behind the jargon called 'functional programming' would go a good way towards that.
More information about the Python-list