[PyQt] Type annotations for QStrings: str or Optional[str]?
me at the-compiler.org
Mon Nov 26 20:41:53 GMT 2018
%MappedType QString /AllowNone,TypeHint="str",TypeHintValue="''"/
At least where Qt functions take a QString as argument, passing None
should always be allowed, so I think Optional[str] would be more
Where they return a QString, I'm not so sure - what happens if Qt
returns a null QString? Even if PyQt maps that to None, it seems rather
cumbersome to have Optional[str] there, as that'd mean you'd need to
check every QString return value for None-ness (which isn't really done
in practice, as often you wouldn't expect to ever get None back).
https://www.qutebrowser.org | me at the-compiler.org (Mail/XMPP)
GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
I love long mails! | https://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 833 bytes
Desc: not available
More information about the PyQt