new.instancemethod as a form of partial()
- From: bonono@xxxxxxxxx
- Date: 21 Jan 2006 21:54:12 -0800
I came across this while searching for a way to DIY partial(), until it
is available in 2.5
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/229472
However, when trying for the following, it doesn't work and is
wondering if it is a bug or intended :
>>> import operator
>>> import new
>>> new.instancemethod(operator.is_,None,object)(None)
Traceback (most recent call last):
File "<pyshell#5>", line 1, in -toplevel-
new.instancemethod(operator.is_,None,object)(None)
TypeError: is_ expected 2 arguments, got 1
>>> new.instancemethod(operator.is_,False,object)(False)
True
So it seems that instancemethod() don't like "None" as the instance.
.
- Follow-Ups:
- Re: new.instancemethod as a form of partial()
- From: Alex Martelli
- Re: new.instancemethod as a form of partial()
- Prev by Date: Re: Regular expressions: recursive patterns and callouts
- Next by Date: Re: new.instancemethod as a form of partial()
- Previous by thread: how to run python scripts on a website
- Next by thread: Re: new.instancemethod as a form of partial()
- Index(es):