[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: Value in specifying arg types for pyqtSignal?
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2021-01-09 10:37:58
Message-ID: 5296b6d2057c7f80c45c5aeb6123b16a () riverbankcomputing ! com
[Download RAW message or body]

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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic