[SIP] Type declarations not added for operator overloads.

Phil Thompson phil at riverbankcomputing.com
Thu Mar 3 16:37:24 GMT 2022


On 01/03/2022 21:46, Greger Stolt Nilsen wrote:
> Code like
> 
> `Vector operator+ (const Vector &other) const;`
> 
> does not get typing added to the .pyi-file, and it seems to be the
> same for all operator-overloads.
> 
> Expected type code would be something like
> 
> `def __add__(self, other: 'Vector') -> Vector ...`
> 
> If this is a hard problem to solve, is there a way to manually add the
> type signatures in the sip-files?
> 
> Best regards
> Greger

Actually those (and others) are explicitly excluded. The comment I wrote 
is...

         /*
          * Ignore slots which can return Py_NotImplemented as code may 
be
          * correctly handled elsewhere.  We also have to include the 
sequence
          * slots because they can't be distinguished from the number 
slots of
          * the same name.
          */

...which (at the moment) makes no sense to me. Should be fixed in the 
next snapshot.

Thanks,
Phil


More information about the PyQt mailing list