[PyQt] QtProperty docstrings
Phil Thompson
phil at riverbankcomputing.com
Sun Oct 25 11:10:00 GMT 2015
On 8 Oct 2015, at 1:10 p.m., Javier Santacruz López-Cepero <jsl at taric.es> wrote:
>
> Hello to all,
>
> I think I detected a strange behaviour with docstrings when using the pyqtProperty decorator.
> It does get the docstring from the doc pyqtProperty parameter but not from the docstring itself:
>
> from PyQt5 import QtCore, QtWidgets
>
> class Test(QtWidgets.QWidget):
> @pyqtProperty(str)
> def data(self):
> """docstring"""
> return "result"
>
> When defining a property like this, the __doc__ attribute is not initialized:
>
>
> In [11]: print(Test.data.__doc__)
> None
>
> But it does work when set directly from the doc parameter:
>
>
> from PyQt5 import QtCore, QtWidgets
>
> class Test(QtWidgets.QWidget):
> @pyqtProperty(str, doc="docstring")
> def data(self):
> return "result"
>
> In [13]: print(Test.data.__doc__)
> doctoring
Should be fixed in tonight's snapshots.
Thanks,
Phil
More information about the PyQt
mailing list