<div dir="ltr"><div><div><div><div>Consider the following example:<br><br><div style="margin-left:40px">from functools import wraps<br>from PyQt4.QtCore import *<br>from PyQt4.QtGui import *<br><br>def decorator(func):<br>    @wraps(func)<br>    def wrapper(*args, **kwargs):<br>        return func(*args, **kwargs)<br>    return wrapper<br><br>class C(QComboBox):<br>    @decorator<br>    def method(self):<br>        print("here")<br><br>app = QApplication([])<br>c = C()<br>c.activated.connect(c.method)<br>c.activated.emit(1)<br></div><br></div>This fails (also under PyQt5) with "TypeError: method() takes 1 positional argument but 2 were given", i.e. the connection was made using the "activated[int]" signal overload.  But the actual signature of "c.method" (as taking no argument) is in fact available (since Python 3.3) via "inspect.signature".<br><br></div>I am thus suggesting to rely on "inspect.signature" for the overload resolution.  (I am aware that decorating with pyqtSlot() can also resolve the ambiguity.)<br><br></div>Thoughts?<br><br></div>Antony Lee<br></div>