On 27/03/2016 14:47, Dennis Lee Bieber wrote:
On Sun, 27 Mar 2016 12:31:26 +0100, BartC <b...@freeuk.com> declaimed the
following:
On 27/03/2016 07:34, Paul Rubin wrote:
BartC <b...@freeuk.com> writes:
But my suggestion was to have required a keyword in front of
such expressions.
Should there be a keyword in front of a line containing "sqrt(x)" ?
What about "launch(missiles)" ?
They both look like function calls. Function calls are *very* commonly
used as standalone expressions.
You /could/ stipulate that they be written:
call launch(missiles) # like Fortran iirc
Except that FORTRAN also explicitly defines them as
subroutine xxx()
vs
return-type function yyy()
and will generate a compile error if you "call" the latter, or put the
former in-line of an expression
This would be the equivalent of removing "def" from Python, and adding
two new keywords: "sub" and "fun"; modifying the behavior so that "fun"s
must have an explicit return statement (preferably with an explicit return
value), whereas "sub"s have no return and just ... end...
Well, that could be done in Python (not so usefully because you can't
take account of such info until a call is attempted), but that's not
what I'm talking about, which is simply allowing:
fn(...)
whether fn has an explicit return or not, and not allowing:
fn # and other kinds of expression
unless some keyword is used. (I've no idea what that might be; all the
best ones are taken. But I've already said a keyword can be emulated via
a dummy function call.)
--
Bartc
--
https://mail.python.org/mailman/listinfo/python-list