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

2005-11-01 Thread Simon Percivall
On 1 nov 2005, at 22.40, Guido van Rossum wrote: >> [Greg Ewing] >>> Maybe ** should be defined for functions so that you >>> could do things like >>> >>>up3levels = dirname ** 3 > > [Raymond Hettinger] >> Hmm, using the function's own namespace is an interesting idea. It >> might also be a go

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

2005-11-01 Thread Guido van Rossum
> [Greg Ewing] > > Maybe ** should be defined for functions so that you > > could do things like > > > >up3levels = dirname ** 3 [Raymond Hettinger] > Hmm, using the function's own namespace is an interesting idea. It > might also be a good place to put other functionals: > >results = f.m

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

2005-11-01 Thread Josiah Carlson
"Delaney, Timothy (Tim)" <[EMAIL PROTECTED]> wrote: > > Reinhold Birkenfeld wrote: > > > And we have solved the "map, filter and reduce are going away! Let's > > all weep together" problem with one strike! > > I'm not sure if you're wildly enthusiastic, or very sarcastic. > > I'm not sure whic

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

2005-11-01 Thread Delaney, Timothy (Tim)
Reinhold Birkenfeld wrote: > And we have solved the "map, filter and reduce are going away! Let's > all weep together" problem with one strike! I'm not sure if you're wildly enthusiastic, or very sarcastic. I'm not sure which I should be either ... The thought does appeal to me - especially fun

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

2005-11-01 Thread Samuele Pedroni
Reinhold Birkenfeld wrote: > Raymond Hettinger wrote: > >>[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(dirn

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

2005-11-01 Thread Noam Raphael
On 11/1/05, Reinhold Birkenfeld <[EMAIL PROTECTED]> wrote: > > 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) > > And we have solved the "map, filter and r

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

2005-11-01 Thread Reinhold Birkenfeld
Raymond Hettinger wrote: > [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

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

2005-11-01 Thread Raymond Hettinger
[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

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

2005-10-31 Thread Greg Ewing
Martin Blais wrote: > 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) Maybe ** should be defined for functions so that you could do

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

2005-10-31 Thread Paul Moore
On 10/31/05, Martin Blais <[EMAIL PROTECTED]> wrote: > 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) [...] > Just wondering, does an

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

2005-10-31 Thread Aahz
On Mon, Oct 31, 2005, Martin Blais wrote: > > There is a way to hack something like that with reduce, but it's not > pretty--it involves creating a temporary list and a lambda function: > > ... = reduce(lambda x, y: dirname(x), [p] + [None] * 3) > > Just wondering, does anybody know how to do t

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

2005-10-31 Thread Martin Blais
Hi I find myself occasionally doing this: ... = dirname(dirname(dirname(p))) 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) There is a