Partially evaluated functions

Carsten Geckeler uioziaremwpl at spammotel.com
Wed Jun 20 16:05:06 EDT 2001


On Wed, 20 Jun 2001, Rainer Deyke wrote:

> "Nick Perkins" <nperkins7 at home.com> wrote in message
> news:VL5Y6.296349$eK2.60381920 at news4.rdc1.on.home.com...
> >
> > "Rainer Deyke" <root at rainerdeyke.com> wrote...
> >
> > > ...
> > > My version is superior in that it doesn't use named arguments.
> Consider:
> > >
> > > def f(self):
> > >   print self
> > >
> > > curry(self = 5) # This will fail with the cookbook version.
> > >
> >
> > ..Of course, you mean:
> >
> > curry(f, self=5)
>
> Yes.
>
> > .. which works fine with the cookbook version.
> > ( why wouldn't it? )
>
> Have you tested it?  In Python 2.0:
>
>
> >>> def f(self, **kwargs):
> ...   print self, kwargs
> ...
> >>> f(f, self=5)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: keyword parameter redefined: self
> >>>

Probably you mean
	curry(f, self=5)
and not
	f(f, self=5)

But you are right that you get a TypeError due to the __init__ function in
the class.

Cheers, Carsten
-- 
Carsten Geckeler





More information about the Python-list mailing list