As we already, in the interpreter, use _ for last result, *vars for unpacking a 
list of positional variables and ** for unpacking to a dictionary how about 
(and this already messes up I18N if you are using _() as an alias for T() to 
mark strings for translation). 

We also currently use the syntax A().B() to do call method A and then call 
method B of the result

How about:
    @piped
    A(params).B(_, options).C(*_).D(**_)
As a reasonably recognisable (ASCII only) syntax where the @piped decorator 
tells us to call each function as soon as we have any returned value(s). The 
other familiar option, (for those used to the bash shell), would be to use a 
bare - as the marker for where to put the result(s) from the previous stage.

Steve Barnes

-----Original Message-----
From: Stephen J. Turnbull <[email protected]> 
Sent: 25 May 2020 02:28
To: Dan Sommers <[email protected]>
Cc: [email protected]
Subject: [Python-ideas] Re: len(path) == len(str(path))

Dan Sommers writes:

 > On the other hand, ∘ ruffles a lot of ASCII feathers (but I'm sure  > Steven 
 > knows that).

On the gripping hand, "<>" looks more or less like a circle :-), and we could 
finally put barry_as_FLUFL __past__ us! ;-)

Here's a wacky syntax idea: to get a partially applied function of one 
argument, substitute the composition symbol for the argument.

So if you have def foo(file, data) and def bar(x, parms) -> data, you could 
compose them with composed = foo(file, <>) <> bar(<>, parms) (closing over file 
and parms), and then apply composed(x).  Not sure about readability, especially 
with lots of arguments, or usability.


_______________________________________________
Python-ideas mailing list -- [email protected] To unsubscribe send an 
email to [email protected] 
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/LVBKHRV4IOX6IDECBB2ST4BF3ZY222NF/
Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/NCUSPPJK7PZOJGTNYKEGTTBCZ2TWJWUJ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to