PyQt6 v6.12.0 stubs - positional-only parameters missing "/"
Phil Thompson
phil at riverbankcomputing.com
Fri Oct 16 14:14:14 BST 2026
On 16/10/2026 13:45, Grzegorz Bokota wrote:
> Will the solution also contain also change of naming in type stubs to
> not
> use a0, a1 etc but use proper descriptive names like "watched" and
> "event"
> from Qt documentation?
> https://doc.qt.io/qt-6/qobject.html#eventFilter bool
> QObject::eventFilter(QObject *watched, QEvent *event)
They will continue to use generated names but the arguments will be
positional only so the names will never be used.
> Is it also possible to stop providing annotations like QObject | None
> for
> call parameters, even if Qt documentation suggests that it can't be
> None
> (also when checking PySide6 documentation, they provide plan QObject)?
> I see that it comes from Qt convention to pass objects as pointers, not
> references, but in reality I don't seen calling an event handler with
> None
> in place of Event. But type checkers still complain that the None case
> is
> not supported, which leads to writing obsolete code.
I don't understand that last sentence. The stubs reflect the
implementation and the Qt API allows you to pass None/NULL, whether or
not it's a good idea. The /DisallowNone/ argument annotation can be used
but that requires every call to be analysed individually.
Phil
More information about the PyQt
mailing list