[Python-Dev] a different kind of reduce...

Raymond Hettinger raymond.hettinger at verizon.net
Tue Nov 1 21:14:32 CET 2005


[Martin Blais]
> > I'm always--literally every time-- looking for a more functional
form,
> > something that would be like this:
> >
> >    # apply dirname() 3 times on its results, initializing with p
> >    ... = repapply(dirname, 3, p)

[Greg Ewing]
> Maybe ** should be defined for functions so that you
> could do things like
> 
>    up3levels = dirname ** 3

Hmm, using the function's own namespace is an interesting idea.  It
might also be a good place to put other functionals:

   results = f.map(data)
   newf = f.partial(somearg)
   

Raymond



More information about the Python-Dev mailing list