Python grammar..

John Roth johnroth at ameritech.net
Wed Jun 13 00:01:42 EDT 2001


"John" <john.thai at dspfactory.com> wrote in message
news:YIaV6.248191$Z2.2856970 at nnrp1.uunet.ca...
> Hi,
>
>     I previously asked whether Python accepts function arguments without
the
> opening/closing brackets and commas, like so:  foo(x,y) would become foo x
> y.  The answer to this was no.  So, I am wondering if it would be easy to
> modify the source and rebuild the interpretor to accept this format?  I
> tried modifying the Grammar file but that didn't seem to work...
>
> Thanks,
>
> John

So what you're saying is that if I have a function "Spam(eggs, ham) and a
function
scramble(<number of eggs>, size = small), then I'd have to write
Spam(scramble(eggs), ham) as
Spam scramble eggs ham.

How do I tell that "ham" is an operand of Spam, and not the second operand
of scramble? The
only way this could possibly work is if the parser could tell, at compile
time, exactly how many
operands each function had. There are languages where this is possible, but
Python isn't one of them.

John Roth
>
>





More information about the Python-list mailing list