This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sbt
Recipients alexandre.vassalotti, asvetlov, daniel.urban, loewis, meador.inge, mstefanro, ncoghlan, rhettinger, sbt, yselivanov
Date 2012-07-20.17:08:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1342804100.32.0.64906939583.issue15397@psf.upfronthosting.co.za>
In-reply-to
Content
Can't you unbind without any changes to the C code by doing

    def unbind(f):
        if hasattr(f, '__func__'):
            return f.__func__
        self = getattr(f, '__self__', None)
        if self is not None and not isinstance(self, types.ModuleType):
            return getattr(type(f.__self__), f.__name__)
        raise TypeError('not a bound method')

Also, I am not convinced that it is a good idea to return f if f is already "unbound".  In practice I think you will always need to treat the bound and the unbound cases differently.
History
Date User Action Args
2012-07-20 17:08:21sbtsetrecipients: + sbt, loewis, rhettinger, ncoghlan, alexandre.vassalotti, asvetlov, meador.inge, daniel.urban, mstefanro, yselivanov
2012-07-20 17:08:20sbtsetmessageid: <1342804100.32.0.64906939583.issue15397@psf.upfronthosting.co.za>
2012-07-20 17:08:19sbtlinkissue15397 messages
2012-07-20 17:08:18sbtcreate