Python grammar..

Joshua Marshall jmarshal at mathworks.com
Mon Jun 11 17:49:55 EDT 2001


John <john.thai at dspfactory.com> wrote:
> 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...

This introduces an ambiguity: how do you parse "f(1,2)"?  Is it the
function f called with 2 arguments or is it f called with one
argument--the tuple (1,2)?  I don't think there's any way to
disambiguate using parens.

This issue doesn't come up in SML (the only other language I know that
uses concatenation for function application) because all functions in
SML take exactly one argument.



More information about the Python-list mailing list