
On Fri, 2011-10-14 at 13:38 +1000, Nick Coghlan wrote:
All PEP 3150 is allowing you to do is indent stuff that could potentially be factored out into a function at some point, without forcing you to factor it out *right now*:
result = flange(thingie) given: thingie = doohickie(majiger) given: part_a = source / 2 part_b = source ** 2 majiger = blender(part_a, part_b)
I don't see it as much advantage for just a few lines of code where you can see the whole thing at once both visually and mentally. # determine source ... # Get flange result part_a = source / 2 part_b = source ** 2 majiger = blender(part_a, part_b) thingie = doohickie(majiger) result = flange(thingie) # do something with flange result ... With comments, I find that it's just as readable, mostly because it's a small enough chunk that the order isn't all that important. If the block of code was one used over again outside that context it would be factored out and you would have this. You could factor it out anyway if it helps make the surrounding code more efficient. # Determine source. ... # Get flange result = get_flange(source) # Do something with flange result ... For very large blocks of code, you might end up with many levels of extra indentation depending on how much nesting there is. To be clear. It's not a bad concept. It's a very nice way to express some problems. I'm just not sure it's needed in Python. On the other hand... The waiting for a block to complete to continue a statement reminds me of futures. http://en.wikipedia.org/wiki/Future_%28programming% 29#Implicit_vs_explicit It would be nice if something like this was also compatible with micro threading. I bet it would be a sure win-win if we could get that from this. (or at least a possibility of it.) Cheers, Ron