On 24/07/2016 11:35, BartC wrote:
On 23/07/2016 16:55, Steven D'Aprano wrote:
In any case, using "end" instead of "pass" is a poor tradeoff. Instead of
needing to use "pass" (say) one time in a thousand when it is needed, you
would need to use "end" 999 times in a thousand when it *isn't* needed.
Yes, well, some of us wouldn't mind!
'end' to terminate a block can be emulated of course:
end=0
def fn(a):
if a<=1:
return 1
else:
return fn(a-1)
end
end
And in this example it wouldn't impact on performance as it is not
evaluated.
But although it can make source code look more conventional, it would
not be supported by the language (repeated, out of place or missing
'end' lines are not an error). And an empty block will still need pass.
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list