[Python-Dev] Suirprise!

Thomas Wouters thomas@xs4all.net
Mon, 23 Apr 2001 14:28:52 +0200


On Sun, Apr 22, 2001 at 08:04:21PM -0700, Paul Prescod wrote:

> The following grammar would preserve it and outlaw confusing cases:

> comparison: in_comparison | is_comparison | math_comparison
> math_comparison: expr (math_comp_op expr)*
> in_comparison: expr ('in' | 'not' 'in' expr)*
> is_comparison: expr ('is' | 'is' 'not' expr)*
> math_comp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='

Won't work. Python's parser can't handle it. I also don't think the grammar
really matters that much -- it's the compiler that does the actual chaining,
it could decide not to chain and force a specific order, if it really wanted
to. And generate warnings and all that :)

-- 
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!