python hack of the day -- "listable" functions

Greg Ewing greg at cosc.canterbury.ac.nz
Wed May 19 22:05:56 EDT 1999


Stefan Franke wrote:
> 
> On Fri, 14 May 1999 20:08:41 GMT, wtanksle at dolphin.openprojects.net (William
> Tanksley) wrote:
> 
> >On Thu, 13 May 1999 22:50:34 GMT, Stefan Franke wrote:
> >>I think function application with $ does follow the rewrite rule
> >
> >>    f(x, y, $[z1, z2, ..., zn], a) ->
> >>   $[f(x, y, z1, a), f(x, y, z2, a), ..., f(x, y, zn, a)]

I missed the beginning of this thread, but perhaps
one of the list-comprehension proposals discussed a
while back would provide a less cryptic way of
expressing this:

   [f(x, y, z, a) for z in [z1, z2, ..., zn]]

-- 
Greg Ewing, Computer Science Dept, | The address below is not spam-
University of Canterbury,	   | protected, so as not to waste
Christchurch, New Zealand	   | the time of Guido van Rossum.
greg at cosc.canterbury.ac.nz




More information about the Python-list mailing list