Value in specifying arg types for pyqtSignal?
Phil Thompson
phil at riverbankcomputing.com
Sat Jan 9 10:37:58 GMT 2021
On 09/01/2021 03:33, Russell Warren wrote:
> When defining a pyqtSignal signal is there any advantage in specifying
> the
> types for the arguments OTHER THAN them being used to match up to the
> correct slot (in the event of signal/slot overloads)?
>
> For example, if only using simple single argument signals paired with
> single argument slots it will always work with `object` as the
> indicated
> type. Is there a disadvantage to being this generic?
>
> For comparison, the pyqtSlot definitions give this advantage for
> decorating
> callables with @pyqtSlot:
>
> > Connecting a signal to a decorated Python method also has the
> advantage
> > of reducing the amount of memory used and is slightly faster.
>
> I'm wondering if something similar exists with the extra effort of
> specifying slot agrg types properly.
Using 'object' will be quicker because of the lack of type conversions.
However...
- explicit is better than implicit
- using the Python object from C++ code would require the C++ code to
have knowledge of Python
Phil
More information about the PyQt
mailing list