Larry Wall's comment on python...

Courageous jkraska at san.rr.com
Thu Sep 26 00:36:41 EDT 2002


On Thu, 26 Sep 2002 14:08:27 +1200, Greg Ewing <see_reply_address at something.invalid>
wrote:

>Jacob Hallen wrote:
>
>> Please note that I didn't say anything about block
>> delimiters or parentheses in this. I think they were put into programming
>> languages to make it easy to write fast compilers.

Even Python uses block delimeters internally in order to properly
parse the language. They are actually inserted by the _LEXER_, which
performs an elaborate indentation-aware transformation of the code,
inserting INDENT and DEDENT tokens into the stream where they are needed.

Hence, this expression...

	for i in mylist:
		expr

...becomes...

	FOR IDENTIFIER IN IDENTIFIER INDENT expr DEDENT

Well, at least notionally. I'm not highly well-informed on the particulars,
and my knowledge may be a bit out of date.

This is, by the way, about the most elegant design pattern one can use
to solve this particular problem. There are many other approaches which
have heinous hidden pitfalls.

C//




More information about the Python-list mailing list