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 bound method is anything else. > > So, when you pass None as the instance, instancemethod likes it just > fine... and returns an "unbound method" as the result, so you haven't > actually achieved your goal (you must still pass the first parameter > explicitly -- all you've "gained" by wrapping a function into an unbound > method is an implicit typecheck on the first argument, and if, as the > class, you're using 'object' as in your example, that's not much use > [even in other cases, it's no great shakes;-)]). > 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 ?
-- http://mail.python.org/mailman/listinfo/python-list