[Python-ideas] Infix functions

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Feb 26 00:02:01 CET 2014


Andrew Barnert wrote re Nick's concise lambda proposal:

>     data = using(:?.read(), open(path))
>     buf = catch(:read_file(path), (FileNotFoundError, :'')
>     b = cond(a, :1/a, :NaN)

This doesn't look like Python to me. It's too cryptic,
especially with the '?'. If you think a colon in
an except-expression looks too confusing, this would
be far worse.

Also, this kind of style would make it very easy to
make subtle mistakes by getting the colons in the
wrong places.

It's not quite the same thing as a Lisp macro, because
the onus is on the caller to remember which arguments
need to be quoted. In Lisp, the macro takes care of
that.

-- 
Greg


More information about the Python-ideas mailing list