Re: new.instancemethod as a form of partial()

2006-01-22 Thread bonono
Alex Martelli wrote: > Guido has mused about abolishing "unbound methods" (in 3.0, I guess), so > there's hope for the future. But a more complete 'partial' is likely to > be acceptable sooner than any fix to bound/unbound methods: I suspect > the only ingredient that's missing is a generous help

Re: new.instancemethod as a form of partial()

2006-01-22 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: ... > thanks. So in this special case, None is being treated as a "flag" > rather than just an instance(I just read the doc) like any other > instance and the behaviour is intended. Is there any reason why it is > designed this way ? I didn't yet know Python back when

Re: new.instancemethod as a form of partial()

2006-01-21 Thread bonono
Alex Martelli wrote: > <[EMAIL PROTECTED]> wrote: >... > > So it seems that instancemethod() don't like "None" as the instance. > > "bound methods" and "unbound methods" are instance of the same type, > distinguished by one thing: the im_self of an unbound method is None, > the im_self of a bo

Re: new.instancemethod as a form of partial()

2006-01-21 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: ... > So it seems that instancemethod() don't like "None" as the instance. "bound methods" and "unbound methods" are instance of the same type, distinguished by one thing: the im_self of an unbound method is None, the im_self of a bound method is anything else. So, w

new.instancemethod as a form of partial()

2006-01-21 Thread bonono
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 >>>