English-like Python

Joe Strout joe at strout.net
Tue Jan 20 15:08:46 EST 2009


Aaron Brady wrote:

> Unambiguity and readability are two different things.  (This should be
> a quasi-tangent, neither agreed, nor opposed, nor unrelated to what
> you said.)
> 
> If you have
> 
> f "abc" 123
> 
> it's unambiguous, but, if you have
> 
> g f "abc" 123 "def"
> 
> there's no sure way to determine where the call to 'f' stopped, and
> the one to 'g' resumed (or, as in Python, if 'f' was even to be called
> at all, as opposed to 4 parameters to 'g').

Right -- that's exactly why (in RB) parentheses are required around 
arguments to a method call if that method returns a value (in RB terms, 
if it is a function rather than a subroutine).  Then there is no 
ambiguity, because only such a function can be used as an argument to 
another method call (or otherwise be part of an expression).  The above 
would have to be written something like:

  g f("abc", 123), "def"

I'm not saying I know how to translate this into Python -- some of 
Python's other language features make this difficult.  Just pointing out 
that your original wish is possible in at least some languages.

Best,
- Joe





More information about the Python-list mailing list