[Python-Dev] Re: accumulator display syntax
Greg Ewing
greg at cosc.canterbury.ac.nz
Tue Oct 21 03:55:23 EDT 2003
> Did I miss April 1st? We seem to be discussing the merits of
>
> f of arg
>
> as an alternative form of
>
> f(arg)
>
> While I'm sure Cobol had some good points, I don't believe that this was one
> of them...
No, some people were *abusing* my suggested accumulator
syntax for things that could have been done more directly
using a function call. It was not meant to be used for
copying or sorting!
I may have misled people a bit by using "sum" in one of
the examples, since there is currently a function by
that name, which wouldn't be directly usable that way.
Just to be clear,
y = accum of f(x) for x in seq
would be equivalent to something like
a = accum()
for x in seq:
a.__consume__(f(x))
y = a.__result__()
which, as you can see, is rather more than just a
function call.
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury, | A citizen of NewZealandCorp, a |
Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. |
greg at cosc.canterbury.ac.nz +--------------------------------------+
More information about the Python-Dev
mailing list