On Wed, Jun 20, 2012 at 6:30 PM, Steven D'Aprano <st...@pearwood.info> wrote: > Speaking of non-instance method descriptors, please excuse this silly > question, I haven't quite understood the implementation well enough to > answer this question myself. Is there anything needed to make > signature() work correctly with custom method-like descriptors such as > this? > > http://code.activestate.com/recipes/577030-dualmethod-descriptor
They're odd enough that they would probably need to implement __signature__ as a property (or custom descriptor) and construct the appropriate signature on the fly. However, that's only necessary if you wanted to support passing the descriptor directly to inspect.signature. The result of Example.method or Example().method would be an ordinary function, which would delegate to signature(self.func) by default (thanks to the use of functools.wraps). To account for the hidden argument correctly, you would actually want to set a custom signature that dropped the first parameter. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com