Re: multi-line expressions

Jack Jansen (Jack.Jansen@cwi.nl)
Fri, 25 Feb 1994 11:44:56 +0100

Recently, "Steven D. Majewski" <sdm7g@elvis.med.virginia.edu> said:
>
> How about ":(" and ")." ?
> With the "frowning Guido"(*) icon [ ":(" ] replacing the ":" in that case:
>
> for x in seq :( if x > 0 : y = f(x) ; else: y = g(x) ; print y ).
>

If we do this, then why not go the whole way? I.e. use (?:) for
if/then/else/end and (:) for for loops? We can also do away with def,
and have lone values in deffed functions act as return values in stead
of printing them.

The advantages of this would be immense. The obscure and lengthy

def isprime(x):
for i in range(2,int(sqrt(x)),2):
if x%i == 0:
return 0
return 1

would become
isprime(x):((i in range(2,int(sqrt(x)),2):(x%i==0?0))1)

Clearly a lot shorter, and easier to parse as well...

Guido, how about it?

--
Jack Jansen        | If I can't dance I don't want to be part of
Jack.Jansen@cwi.nl | your revolution             -- Emma Goldman
uunet!cwi.nl!jack    G=Jack;S=Jansen;O=cwi;PRMD=surf;ADMD=400net;C=nl