Dr. Dobb's Python-URL! - weekly Python news and links (Mar 26)
phil hunt
philh at comuno.freeserve.co.uk
Wed Mar 27 19:39:43 EST 2002
On Thu, 28 Mar 2002 00:17:11 +0000, phil hunt <philh at comuno.freeserve.co.uk> wrote:
>On Wed, 27 Mar 2002 17:05:58 GMT, Courageous <jkraska at san.rr.com> wrote:
>>
>>>And then, when you begin to flesh out your code, you would have to
>>>get rid of the extraneous passes you didn't want to add (assuming
>>>you are like me) in the first place. So the with-pass version
>>>requires more effort, and is more verbose, for no good reason.
>>
>>The reasons are related to the implementation and not the design
>>of Python, I believe.
>
>Oh?
>
>Can it really be hard to modify python so that pass is optional?
>
>The relvant file is grammar, line 68 of which reads:
>
> suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT
>
>I wonder if I could change this to something like:
>
> suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT | NEWLINE
>
>(It's current;ly compiling; i will get back on this)
I've just tried:
suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT | NEWLINE
suite: simple_stmt | NEWLINE INDENT stmt* DEDENT
suite: simple_stmt | NEWLINE [INDENT stmt+ DEDENT]
None of which work. Mind you, I don't know the language of the
python parser-generator, having never seen it before, and so I am
just guessing things that looks like they might work. No doubt
someone more familiar with it could do better.
--
<"><"><"> Philip Hunt <philh at comuno.freeserve.co.uk> <"><"><">
"I would guess that he really believes whatever is politically
advantageous for him to believe."
-- Alison Brooks, referring to Michael
Portillo, on soc.history.what-if
More information about the Python-list
mailing list