new.instancemethod as a form of partial()
aleax at mail.comcast.net
Sun Jan 22 10:11:23 EST 2006
<bonono at gmail.com> 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 it was designed (dark ages, really),
but I assume the point was that, back then, we only had what's now the
legacy object model: bound methods could only be bound to instances,
classes were distinct from types, etc. So, an im_self that wasn't an
instance had no possible "normal" meaning, and None was a handy
placeholder. Of course, this design then couldn't be changed (nor can
it be now, until 3.0) to preserve backwards compatibility.
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 helping of irrefutable
More information about the Python-list