[Python-ideas] Python reviewed
Chris Angelico
rosuav at gmail.com
Mon Jan 9 21:56:36 EST 2017
On Tue, Jan 10, 2017 at 12:44 PM, Simon Lovell <simon58500 at bigpond.com> wrote:
> Regarding the logical inconsistency of my argument, well I am saying that I
> would prefer my redundancy at the end of the loop rather than the beginning.
> To say that the status quo is better is to say that you prefer your
> redundancy at the beginning. Fair enough, I'm happy to respect your opinion
> there. I still struggle to see why it should be mandatory though? For those
> who prefer to have the block closing delimiters this way, is the need for a
> keyword (could be a command line option) really the objection?
Actually, Python does have a way to enable optional block closing
directives. They're a little more compact than "endfor" and "endwhile"
etc, and they're optional, so the compiler won't require you to use
them (that would break heaps of libraries), but try this:
-- cut --
import sys
for arg in sys.argv:
if arg == "hello":
print("Hello, sir/madam")
#if
#for
-- cut --
Okay, okay, that's a bit of a cheat, but still, if you really truly
want "endfor", all you have to do is spell it "#for" and it'll be
accepted. Don't expect experienced Python programmers to accept this
at code review though.
(And if you insist on a command line option, "python3 -X hashblockend"
will do that for you. It won't actually DO anything though.)
ChrisA
More information about the Python-ideas
mailing list