On 1/1/2010 5:05 PM Steven D'Aprano said...
In Python terms, imagine if we could write

     foriinrange(10):

instead of the usual

     for i in range(10):

Since the colon makes it unambiguous that it is some sort of block
construct, and it starts with "for", it must be a for loop. Pretty
horrible, yes?


Yes -- early on I got stung by something similar. My first programming job (1977?) was working in a basic dialect called Buisness Basic Level II (BBII). To delete a record in the file you used a remove statement. White space on the line was optional, allowing you to write lines like '100 remove(1,key=k$)' and '100 fori=1to10'. REM was how a remark statement began, which allowed statements like "100 REM comment". I was sent on-site to a customer running the prior version (BBI). I didn't realize the REMOVE command changed between versions from REKEY, and it was only after a more experienced programmer co-wroker pointed out that my REMOVE statement was being interpreted as a REM that I finally found the bug I'd created.

Manuals and documentation, while often lacking, are as often underrated.

Emile


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to