<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 1/9/17 8:44 PM, Simon Lovell wrote:<br>
<blockquote
cite="mid:451e10fa-f437-2132-8a0f-a167b78fac6a@bigpond.com"
type="cite">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
<p>Also in Python you can use:</p>
<p>for x in range (1,j+1):</p>
<p>to loop j times. Although it does read as though it is looping
j+1 times to those not familiar.</p>
<p>One more comment I wanted to make about end blocks, is that a
respectable editor will add them for you, together with the
indentation of the next line. EditPlus 2 did it best in my
experience although I think I just haven't seen a well
configured alternative. I very rarely forget the block closer
but I do sometimes forget the colon.</p>
<p>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? <br>
</p>
</blockquote>
<br>
Can you clarify something for us? Are you proposing to add end-block
syntax? You've said you prefer it, and that you miss it. But you
haven't said, "I am proposing that Python should change." This list
is about proposing changes to Python. Are you proposing that Python
change in this way?<br>
<br>
You understand that this is a significant shift from a syntax that
has been in place for a quarter century? Perhaps you should give
yourself time to get used to Python as Python is.<br>
<br>
--Ned.<br>
<br>
<blockquote
cite="mid:451e10fa-f437-2132-8a0f-a167b78fac6a@bigpond.com"
type="cite">
<p> </p>
<p><br>
</p>
<p>I'll have a detailed look at your colon link a bit later.<br>
</p>
<br>
<div class="moz-cite-prefix">On 10/01/17 09:26, Chris Barker
wrote:<br>
</div>
<blockquote
cite="mid:CALGmxE+ih76Od5fOJgeBafd+E-pWAvQNAp5pWq4hfi2JQBa7Dg@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On Mon, Jan 9, 2017 at 5:12 PM,
Simon Lovell <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:simon58500@bigpond.com" target="_blank">simon58500@bigpond.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Re:
Counters starting at zero vs one, Fortran has a neat
solution to this for arrays if not strings - allow the
programmer to select the starting index.</blockquote>
<div><br>
</div>
<div>I liked that back in the day, but I think it's really
better if it's always the same.</div>
<div><br>
</div>
<div>and see my other note for why the zero-based and open
ended slicing is fabulous -- indexing really needs to
match slicing.</div>
<div><br>
</div>
<div>ONe more:</div>
<div><br>
</div>
<div>since you mentioned Fortran -- it's a common use-case
for an array to model some sort of regular spaced grid,
so:</div>
<div><br>
</div>
<div>x = start_x + i*delta_x</div>
<div><br>
</div>
<div>really easy and logical math for figuring out where
you are on a grid (and the reverse calculation) -- this
is a pain with 1-based indexing....</div>
<div><br>
</div>
<div>(of course, C does this for pointer math for the same
reason...)</div>
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">When
I've programmed for loops in C, sometimes you want zero
based and sometimes one based, while most times you
don't really care. To make it readable I would wherever
possible write either:<br>
for (i=0;i<j;i++)<br>
for (i=1;i<=j;i++) // In both cases always
executing j times<br>
</blockquote>
<div><br>
</div>
<div>in pyton, you never right that code anyway. most of
the time, it's </div>
<div><br>
</div>
<div>for item in sequence:</div>
<div><br>
</div>
<div>no indexes at all.</div>
<div><br>
</div>
<div>or:</div>
<div><br>
</div>
<div>for i in range(N):</div>
<div> ...</div>
<div><br>
</div>
<div>indexes, but you dont care</div>
<div><br>
</div>
<div>or </div>
<div><br>
</div>
<div>for i, item in enumerate(seq):</div>
<div> ...</div>
<div><br>
</div>
<div>or for item1, item2 in zip(sequence):</div>
<div> ...</div>
<div><br>
</div>
<div>i.e you almost never care what the starting index is!</div>
<div><br>
</div>
<div>-CHB</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex"> Rgds
<div class="HOEnZb">
<div class="h5"><br>
______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a moz-do-not-send="true"
href="mailto:Python-ideas@python.org"
target="_blank">Python-ideas@python.org</a><br>
<a moz-do-not-send="true"
href="https://mail.python.org/mailman/listinfo/python-ideas"
rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/python-ideas</a><br>
Code of Conduct: <a moz-do-not-send="true"
href="http://python.org/psf/codeofconduct/"
rel="noreferrer" target="_blank">http://python.org/psf/codeofco<wbr>nduct/</a><br>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div class="gmail_signature"
data-smartmail="gmail_signature"><br>
Christopher Barker, Ph.D.<br>
Oceanographer<br>
<br>
Emergency Response Division<br>
NOAA/NOS/OR&R (206) 526-6959 voice<br>
7600 Sand Point Way NE (206) 526-6329 fax<br>
Seattle, WA 98115 (206) 526-6317 main reception<br>
<br>
<a moz-do-not-send="true"
href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a></div>
</div>
</div>
</blockquote>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Python-ideas mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Python-ideas@python.org">Python-ideas@python.org</a>
<a class="moz-txt-link-freetext" href="https://mail.python.org/mailman/listinfo/python-ideas">https://mail.python.org/mailman/listinfo/python-ideas</a>
Code of Conduct: <a class="moz-txt-link-freetext" href="http://python.org/psf/codeofconduct/">http://python.org/psf/codeofconduct/</a></pre>
</blockquote>
<br>
</body>
</html>