From tismer at stackless.com Thu Sep 21 15:04:53 2017 From: tismer at stackless.com (Christian Tismer) Date: Thu, 21 Sep 2017 15:04:53 +0200 Subject: [PySide] The Signature Module for PySide2 Message-ID: <87098b41-d39f-67b0-12bc-e4367a7b4dc5@stackless.com> Hi friends, there is the new signature module for PySide2. It adds the __signature__ attribute to all PySide2 functions and constructors. Example usage: >>> PySide2.QtWidgets.QGraphicsAnchorLayout.addAnchors.__signature__ >>> PySide2.QtWidgets.QGraphicsAnchorLayout.__signature__ will print all annotations, defaults and return values. The feature supports Python 2.7 and Python 3.4 and up. See further info at https://bugreports.qt.io/browse/PYSIDE-510 https://github.com/pyside/pyside2-setup/blob/5.6/sources/shiboken2/libshiboken/signature.cpp https://github.com/pyside/pyside2-setup/blob/5.6/sources/shiboken2/libshiboken/signature.cpp Cheers -- Chris -- Christian Tismer :^) tismer at stackless.com Software Consulting : http://www.stackless.com/ Karl-Liebknecht-Str. 121 : https://github.com/PySide 14482 Potsdam : GPG key -> 0xFB7BEE0E phone +49 173 24 18 776 fax +49 (30) 700143-0023 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 522 bytes Desc: OpenPGP digital signature URL: From tismer at stackless.com Thu Sep 21 15:25:55 2017 From: tismer at stackless.com (Christian Tismer) Date: Thu, 21 Sep 2017 15:25:55 +0200 Subject: [PySide] The Signature Module for PySide2 In-Reply-To: <87098b41-d39f-67b0-12bc-e4367a7b4dc5@stackless.com> References: <87098b41-d39f-67b0-12bc-e4367a7b4dc5@stackless.com> Message-ID: <671f6e66-3db4-dd49-4a54-3c462b577fe7@stackless.com> > Hi friends, > > there is the new signature module for PySide2. > It adds the __signature__ attribute to all PySide2 > functions and constructors. > > Example usage: > >>>> PySide2.QtWidgets.QGraphicsAnchorLayout.addAnchors.__signature__ >>>> PySide2.QtWidgets.QGraphicsAnchorLayout.__signature__ > > will print all annotations, defaults and return values. > > The feature supports Python 2.7 and Python 3.4 and up. > See further info at > > https://bugreports.qt.io/browse/PYSIDE-510 > > https://github.com/pyside/pyside2-setup/blob/5.6/sources/shiboken2/libshiboken/signature.cpp https://github.com/pyside/pyside2-setup/tree/5.6/sources/pyside2/PySide2/support/signature -- Christian Tismer :^) tismer at stackless.com Software Consulting : http://www.stackless.com/ Karl-Liebknecht-Str. 121 : https://github.com/PySide 14482 Potsdam : GPG key -> 0xFB7BEE0E phone +49 173 24 18 776 fax +49 (30) 700143-0023 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 522 bytes Desc: OpenPGP digital signature URL: From redstone-cold at 163.com Fri Sep 22 07:07:37 2017 From: redstone-cold at 163.com (Zhao Lee) Date: Fri, 22 Sep 2017 13:07:37 +0800 (CST) Subject: [PySide] The Signature Module for PySide2 In-Reply-To: <87098b41-d39f-67b0-12bc-e4367a7b4dc5@stackless.com> References: <87098b41-d39f-67b0-12bc-e4367a7b4dc5@stackless.com> Message-ID: <2658af9.153.15ea7fbe6b8.Coremail.redstone-cold@163.com> why not? >>> help(PySide2.QtWidgets.QGraphicsAnchorLayout.addAnchors) >>> help(PySide2.QtWidgets.QGraphicsAnchorLayout) 在2017年09月21 21时04分, "Christian Tismer"写道: Hi friends, there is the new signature module for PySide2. It adds the __signature__ attribute to all PySide2 functions and constructors. Example usage: >>> PySide2.QtWidgets.QGraphicsAnchorLayout.addAnchors.__signature__ >>> PySide2.QtWidgets.QGraphicsAnchorLayout.__signature__ will print all annotations, defaults and return values. The feature supports Python 2.7 and Python 3.4 and up. See further info at https://bugreports.qt.io/browse/PYSIDE-510 https://github.com/pyside/pyside2-setup/blob/5.6/sources/shiboken2/libshiboken/signature.cpp https://github.com/pyside/pyside2-setup/blob/5.6/sources/shiboken2/libshiboken/signature.cpp Cheers -- Chris -- Christian Tismer :^) tismer at stackless.com Software Consulting : http://www.stackless.com/ Karl-Liebknecht-Str. 121 : https://github.com/PySide 14482 Potsdam : GPG key -> 0xFB7BEE0E phone +49 173 24 18 776 fax +49 (30) 700143-0023 -------------- next part -------------- An HTML attachment was scrubbed... URL: From redstone-cold at 163.com Sat Sep 23 04:36:58 2017 From: redstone-cold at 163.com (Zhao Lee) Date: Sat, 23 Sep 2017 10:36:58 +0800 (CST) Subject: [PySide] The Signature Module for PySide2 In-Reply-To: References: <87098b41-d39f-67b0-12bc-e4367a7b4dc5@stackless.com> <2658af9.153.15ea7fbe6b8.Coremail.redstone-cold@163.com> Message-ID: <71a71ce5.77.15eac9856eb.Coremail.redstone-cold@163.com> Sorry, I just feel the feature is just like what help() function do in Python https://docs.python.org/3/library/functions.html#help an example with PyQt5 >>> from PyQt5.QtWidgets import QApplication >>> help(QApplication.startTimer) Help on built-in function startTimer: startTimer(...) startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) -> int >>> 在2017年09月22 16时42分, "Christian Tismer"写道: Hi, please re-submit your reply in a readable way. I could read it locally, but the mailing list does not have a readable answer from you, just my copied text. Can you please come up with more than just "why not?"? I need a proposal how the help should look like. Thanks in advance -- Chris On 22.09.17 07:07, Zhao Lee wrote: > why not? >>>> help(PySide2.QtWidgets.QGraphicsAnchorLayout.addAnchors) >>>> help(PySide2.QtWidgets.QGraphicsAnchorLayout) > > > > 在2017年09月21 21时04分, "Christian Tismer"写道: > > > Hi friends, > > there is the new signature module for PySide2. > It adds the __signature__ attribute to all PySide2 > functions and constructors. > > Example usage: > > >>> PySide2.QtWidgets.QGraphicsAnchorLayout.addAnchors.__signature__ > >>> PySide2.QtWidgets.QGraphicsAnchorLayout.__signature__ > > will print all annotations, defaults and return values. > > The feature supports Python 2.7 and Python 3.4 and up. > See further info at > > https://bugreports.qt.io/browse/PYSIDE-510 > > https://github.com/pyside/pyside2-setup/blob/5.6/sources/shiboken2/libshiboken/signature.cpp > > https://github.com/pyside/pyside2-setup/blob/5.6/sources/shiboken2/libshiboken/signature.cpp > > Cheers -- Chris > > -- > Christian Tismer :^) tismer at stackless.com > > Software Consulting : http://www.stackless.com/ > Karl-Liebknecht-Str. 121 : https://github.com/PySide > 14482 Potsdam : GPG key -> 0xFB7BEE0E > phone +49 173 24 18 776 fax +49 (30) 700143-0023 > > > > > > > -- Christian Tismer :^) tismer at stackless.com Software Consulting : http://www.stackless.com/ Karl-Liebknecht-Str. 121 : https://github.com/PySide 14482 Potsdam : GPG key -> 0xFB7BEE0E phone +49 173 24 18 776 fax +49 (30) 700143-0023 -------------- next part -------------- An HTML attachment was scrubbed... URL: From bhood2 at comcast.net Sat Sep 23 04:49:51 2017 From: bhood2 at comcast.net (Bob Hood) Date: Fri, 22 Sep 2017 20:49:51 -0600 Subject: [PySide] The Signature Module for PySide2 In-Reply-To: <71a71ce5.77.15eac9856eb.Coremail.redstone-cold@163.com> References: <87098b41-d39f-67b0-12bc-e4367a7b4dc5@stackless.com> <2658af9.153.15ea7fbe6b8.Coremail.redstone-cold@163.com> <71a71ce5.77.15eac9856eb.Coremail.redstone-cold@163.com> Message-ID: <1d123bdc-a38d-fef6-7775-aff43f5de337@comcast.net> I could be wrong, because I'm not familiar with the "__signature__" attribute, but I believe it is intended to facilitate /introspection/ of classes and methods.  When Christian said "prints", I think he just meant you get to see what the attribute holds, not that it should be used as documentation. You could programmatically access the attributes data, and make run-time use of it.  You can't really do that with the help() output unless you want go to great lengths to parse it. Sorry if I'm way off here. On 9/22/2017 8:36 PM, Zhao Lee wrote: > Sorry, I just feel the feature is just like what help() function do in Python > https://docs.python.org/3/library/functions.html#help > > an example with PyQt5 > >>> from PyQt5.QtWidgets import QApplication > >>> help(QApplication.startTimer) > Help on built-in function startTimer: > > startTimer(...) >     startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) -> int > > >>> > > > 在2017年09月22 16时42分, "Christian Tismer"写道: > > > Hi, > > please re-submit your reply in a readable way. > I could read it locally, but the mailing list does not > have a readable answer from you, just my copied text. > > Can you please come up with more than just "why not?"? > I need a proposal how the help should look like. > > Thanks in advance -- Chris > > > On 22.09.17 07:07, Zhao Lee wrote: > > why not? > >>>> help(PySide2.QtWidgets.QGraphicsAnchorLayout.addAnchors) > >>>> help(PySide2.QtWidgets.QGraphicsAnchorLayout) > > > > > > > > 在2017年09月21 21时04分, "Christian Tismer" >写道: > > > > > >     Hi friends, > > > >     there is the new signature module for PySide2. > >     It adds the __signature__ attribute to all PySide2 > >     functions and constructors. > > > >     Example usage: > > > >     >>> PySide2.QtWidgets.QGraphicsAnchorLayout.addAnchors.__signature__ > >     >>> PySide2.QtWidgets.QGraphicsAnchorLayout.__signature__ > > > >     will print all annotations, defaults and return values. > > > >     The feature supports Python 2.7 and Python 3.4 and up. > >     See further info at > > > >        https://bugreports.qt.io/browse/PYSIDE-510 > > > > > https://github.com/pyside/pyside2-setup/blob/5.6/sources/shiboken2/libshiboken/signature.cpp > > > > > https://github.com/pyside/pyside2-setup/blob/5.6/sources/shiboken2/libshiboken/signature.cpp > > > >     Cheers -- Chris > > > >     -- > >     Christian Tismer             :^) tismer at stackless.com > > >     > > >     Software Consulting          : http://www.stackless.com/ > >     Karl-Liebknecht-Str. 121     : https://github.com/PySide > >     14482 Potsdam                :     GPG key -> 0xFB7BEE0E > >     phone +49 173 24 18 776  fax +49 (30) 700143-0023 > > > > > > > > > > > > > > > > > -- > Christian Tismer             :^) tismer at stackless.com > > Software Consulting          :     http://www.stackless.com/ > Karl-Liebknecht-Str. 121     :     https://github.com/PySide > 14482 Potsdam                :     GPG key -> 0xFB7BEE0E > phone +49 173 24 18 776  fax +49 (30) 700143-0023 > > > > > > _______________________________________________ PySide mailing list > PySide at qt-project.org http://lists.qt-project.org/mailman/listinfo/pyside -------------- next part -------------- An HTML attachment was scrubbed... URL: From tismer at stackless.com Sat Sep 23 16:05:37 2017 From: tismer at stackless.com (Christian Tismer) Date: Sat, 23 Sep 2017 16:05:37 +0200 Subject: [PySide] The Signature Module for PySide2 In-Reply-To: <71a71ce5.77.15eac9856eb.Coremail.redstone-cold@163.com> References: <87098b41-d39f-67b0-12bc-e4367a7b4dc5@stackless.com> <2658af9.153.15ea7fbe6b8.Coremail.redstone-cold@163.com> <71a71ce5.77.15eac9856eb.Coremail.redstone-cold@163.com> Message-ID: Hi Zhao, interesting. I looked into PyQt5 and found out that - __text__signature__ is not used at all - __doc__ contains what the help() shows. That means I can use my signature to generate similar doc strings quite easily. The feature is a bit more than the help, because signature objects are real objects, not just strings. I think people can do much more with that than just reading out the signature. Internally, we are going to base a huge test suite upon this that goes thru every function about exactness, completeness, crashes, correct arguments and the like, and we will maintain a registry that holds this info. I am starting very small to build this registry by hand and store for instance "you cannot create a QPixmap if you don't have a QApplication" This is an area where both PySide2 and PyQt5 are simply crashing, today, because Qt is not aware that it is used in interactive environments. To fix problems like these, I developed the signature package. Thanks for your idea -- Chris On 23.09.17 04:36, Zhao Lee wrote: > Sorry, I just feel the feature is just like what help() function do in > Python  > https://docs.python.org/3/library/functions.html#help > > an example with PyQt5 >>>> from PyQt5.QtWidgets import QApplication >>>> help(QApplication.startTimer) > Help on built-in function startTimer: > > startTimer(...) >     startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) -> int > >>>>  > > > 在2017年09月22 16时42分, "Christian Tismer"写道: > > > Hi, > > please re-submit your reply in a readable way. > I could read it locally, but the mailing list does not > have a readable answer from you, just my copied text. > > Can you please come up with more than just "why not?"? > I need a proposal how the help should look like. > > Thanks in advance -- Chris > > > On 22.09.17 07:07, Zhao Lee wrote: > > why not? > >>>> help(PySide2.QtWidgets.QGraphicsAnchorLayout.addAnchors) > >>>> help(PySide2.QtWidgets.QGraphicsAnchorLayout) > > > > > > > > 在2017年09月21 21时04分, "Christian Tismer" >写道: > > > > > >     Hi friends, > > > >     there is the new signature module for PySide2. > >     It adds the __signature__ attribute to all PySide2 > >     functions and constructors. > > > >     Example usage: > > > >     >>> > PySide2.QtWidgets.QGraphicsAnchorLayout.addAnchors.__signature__ > >     >>> PySide2.QtWidgets.QGraphicsAnchorLayout.__signature__ > > > >     will print all annotations, defaults and return values. > > > >     The feature supports Python 2.7 and Python 3.4 and up. > >     See further info at > > > >        https://bugreports.qt.io/browse/PYSIDE-510 > > > >     > https://github.com/pyside/pyside2-setup/blob/5.6/sources/shiboken2/libshiboken/signature.cpp > > > >     > https://github.com/pyside/pyside2-setup/blob/5.6/sources/shiboken2/libshiboken/signature.cpp > > > >     Cheers -- Chris > > > >     -- > >     Christian Tismer             :^)   tismer at stackless.com > > >     > > >     Software Consulting          :     http://www.stackless.com/ > >     Karl-Liebknecht-Str. 121     :     https://github.com/PySide > >     14482 Potsdam                :     GPG key -> 0xFB7BEE0E > >     phone +49 173 24 18 776  fax +49 (30) 700143-0023 > > > > > > > > > > > >   > > > > > -- > Christian Tismer             :^)   tismer at stackless.com > > Software Consulting          :     http://www.stackless.com/ > Karl-Liebknecht-Str. 121     :     https://github.com/PySide > 14482 Potsdam                :     GPG key -> 0xFB7BEE0E > phone +49 173 24 18 776  fax +49 (30) 700143-0023 > > > >   > -- Christian Tismer :^) tismer at stackless.com Software Consulting : http://www.stackless.com/ Karl-Liebknecht-Str. 121 : https://github.com/PySide 14482 Potsdam : GPG key -> 0xFB7BEE0E phone +49 173 24 18 776 fax +49 (30) 700143-0023 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 522 bytes Desc: OpenPGP digital signature URL: From tismer at stackless.com Sun Sep 24 05:55:27 2017 From: tismer at stackless.com (Christian Tismer) Date: Sun, 24 Sep 2017 05:55:27 +0200 Subject: [PySide] The Signature Module for PySide2 In-Reply-To: <1d123bdc-a38d-fef6-7775-aff43f5de337@comcast.net> References: <87098b41-d39f-67b0-12bc-e4367a7b4dc5@stackless.com> <2658af9.153.15ea7fbe6b8.Coremail.redstone-cold@163.com> <71a71ce5.77.15eac9856eb.Coremail.redstone-cold@163.com> <1d123bdc-a38d-fef6-7775-aff43f5de337@comcast.net> Message-ID: <36f07c8d-4194-926a-49ea-1b304389b5fc@stackless.com> Bob, you are right. The __signature__ object is a true object for introspection and you can directly use it to build a function call programmatically or find default arguments. Not as strings but as life objects. I think that is a pretty unique feature. I know only of Cython who creates signature objects from PyCFunctions. Therefore I expected more enthusiastic reactions, the feature was very hard to implement. And sure, the doc strings could be derived from it. Probably I should have pointed people at PEP 362 ff. Cheers -- Chris On 23.09.17 04:49, Bob Hood wrote: > I could be wrong, because I'm not familiar with the "__signature__" > attribute, but I believe it is intended to facilitate /introspection/ of > classes and methods.  When Christian said "prints", I think he just > meant you get to see what the attribute holds, not that it should be > used as documentation. > > You could programmatically access the attributes data, and make run-time > use of it.  You can't really do that with the help() output unless you > want go to great lengths to parse it. > > Sorry if I'm way off here. > > > On 9/22/2017 8:36 PM, Zhao Lee wrote: >> Sorry, I just feel the feature is just like what help() function do in >> Python  >> https://docs.python.org/3/library/functions.html#help >> >> an example with PyQt5 >> >>> from PyQt5.QtWidgets import QApplication >> >>> help(QApplication.startTimer) >> Help on built-in function startTimer: >> >> startTimer(...) >>     startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) -> int >> >> >>>  >> >> >> 在2017年09月22 16时42分, "Christian Tismer"写道: >> >> >> Hi, >> >> please re-submit your reply in a readable way. >> I could read it locally, but the mailing list does not >> have a readable answer from you, just my copied text. >> >> Can you please come up with more than just "why not?"? >> I need a proposal how the help should look like. >> >> Thanks in advance -- Chris >> >> >> On 22.09.17 07:07, Zhao Lee wrote: >> > why not? >> >>>> help(PySide2.QtWidgets.QGraphicsAnchorLayout.addAnchors) >> >>>> help(PySide2.QtWidgets.QGraphicsAnchorLayout) >> > >> > >> > >> > 在2017年09月21 21时04分, "Christian Tismer"> >写道: >> > >> > >> >     Hi friends, >> > >> >     there is the new signature module for PySide2. >> >     It adds the __signature__ attribute to all PySide2 >> >     functions and constructors. >> > >> >     Example usage: >> > >> >     >>> >> PySide2.QtWidgets.QGraphicsAnchorLayout.addAnchors.__signature__ >> >     >>> PySide2.QtWidgets.QGraphicsAnchorLayout.__signature__ >> > >> >     will print all annotations, defaults and return values. >> > >> >     The feature supports Python 2.7 and Python 3.4 and up. >> >     See further info at >> > >> >        https://bugreports.qt.io/browse/PYSIDE-510 >> > >> >     >> https://github.com/pyside/pyside2-setup/blob/5.6/sources/shiboken2/libshiboken/signature.cpp >> > >> >     >> https://github.com/pyside/pyside2-setup/blob/5.6/sources/shiboken2/libshiboken/signature.cpp >> > >> >     Cheers -- Chris >> > >> >     -- >> >     Christian Tismer             :^)   tismer at stackless.com >> >> >     > >> >     Software Consulting          :     http://www.stackless.com/ >> >     Karl-Liebknecht-Str. 121     :     https://github.com/PySide >> >     14482 Potsdam                :     GPG key -> 0xFB7BEE0E >> >     phone +49 173 24 18 776  fax +49 (30) 700143-0023 >> > >> > >> > >> > >> > >> >   >> > >> >> >> -- >> Christian Tismer             :^)   tismer at stackless.com >> >> Software Consulting          :     http://www.stackless.com/ >> Karl-Liebknecht-Str. 121     :     https://github.com/PySide >> 14482 Potsdam                :     GPG key -> 0xFB7BEE0E >> phone +49 173 24 18 776  fax +49 (30) 700143-0023 >> >> >> >>   >> >> >> >> _______________________________________________ PySide mailing list >> PySide at qt-project.org http://lists.qt-project.org/mailman/listinfo/pyside > > > > _______________________________________________ > PySide mailing list > PySide at qt-project.org > http://lists.qt-project.org/mailman/listinfo/pyside > -- Christian Tismer :^) tismer at stackless.com Software Consulting : http://www.stackless.com/ Karl-Liebknecht-Str. 121 : https://github.com/PySide 14482 Potsdam : GPG key -> 0xFB7BEE0E phone +49 173 24 18 776 fax +49 (30) 700143-0023 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 522 bytes Desc: OpenPGP digital signature URL: From bhood2 at comcast.net Sun Sep 24 15:59:22 2017 From: bhood2 at comcast.net (Bob Hood) Date: Sun, 24 Sep 2017 07:59:22 -0600 Subject: [PySide] The Signature Module for PySide2 In-Reply-To: <36f07c8d-4194-926a-49ea-1b304389b5fc@stackless.com> References: <87098b41-d39f-67b0-12bc-e4367a7b4dc5@stackless.com> <2658af9.153.15ea7fbe6b8.Coremail.redstone-cold@163.com> <71a71ce5.77.15eac9856eb.Coremail.redstone-cold@163.com> <1d123bdc-a38d-fef6-7775-aff43f5de337@comcast.net> <36f07c8d-4194-926a-49ea-1b304389b5fc@stackless.com> Message-ID: <7324ab8f-6bec-fd65-740e-98c36fb96cda@comcast.net> I think introspection is still a fairly uncommon area for most programmers,even professional software engineers.  Like many things Qt does, it has leveraged introspection to great benefit, but there's no requirement to actually know about or understand introspection in order to use Qt(either via C++ or through PySide).Until it comes as a standard in a mainstream language,like C++, I don't think you will see widespread understanding or appreciation of its power. And if it's any consolation, I appreciate what you've done, Chris.  :) On 9/23/2017 9:55 PM, Christian Tismer wrote: > Bob, you are right. The __signature__ object is a true object for > introspection and you can directly use it to build a function > call programmatically or find default arguments. Not as strings > but as life objects. > > I think that is a pretty unique feature. I know only of Cython > who creates signature objects from PyCFunctions. Therefore I expected > more enthusiastic reactions, the feature was very hard to implement. > And sure, the doc strings could be derived from it. > > Probably I should have pointed people at PEP 362 ff. > > Cheers -- Chris > > > On 23.09.17 04:49, Bob Hood wrote: >> I could be wrong, because I'm not familiar with the "__signature__" >> attribute, but I believe it is intended to facilitate /introspection/ of >> classes and methods.  When Christian said "prints", I think he just >> meant you get to see what the attribute holds, not that it should be >> used as documentation. >> >> You could programmatically access the attributes data, and make run-time >> use of it.  You can't really do that with the help() output unless you >> want go to great lengths to parse it. >> >> Sorry if I'm way off here. >> >> >> On 9/22/2017 8:36 PM, Zhao Lee wrote: >>> Sorry, I just feel the feature is just like what help() function do in >>> Python >>> https://docs.python.org/3/library/functions.html#help >>> >>> an example with PyQt5 >>>>>> from PyQt5.QtWidgets import QApplication >>>>>> help(QApplication.startTimer) >>> Help on built-in function startTimer: >>> >>> startTimer(...) >>>     startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) -> int >>> >>>>>> >>> >>> 在2017年09月22 16时42分, "Christian Tismer"写道: >>> >>> >>> Hi, >>> >>> please re-submit your reply in a readable way. >>> I could read it locally, but the mailing list does not >>> have a readable answer from you, just my copied text. >>> >>> Can you please come up with more than just "why not?"? >>> I need a proposal how the help should look like. >>> >>> Thanks in advance -- Chris >>> >>> >>> On 22.09.17 07:07, Zhao Lee wrote: >>> > why not? >>> >>>> help(PySide2.QtWidgets.QGraphicsAnchorLayout.addAnchors) >>> >>>> help(PySide2.QtWidgets.QGraphicsAnchorLayout) >>> > >>> > >>> > >>> > 在2017年09月21 21时04分, "Christian Tismer">> >写道: >>> > >>> > >>> >     Hi friends, >>> > >>> >     there is the new signature module for PySide2. >>> >     It adds the __signature__ attribute to all PySide2 >>> >     functions and constructors. >>> > >>> >     Example usage: >>> > >>> >     >>> >>> PySide2.QtWidgets.QGraphicsAnchorLayout.addAnchors.__signature__ >>> >     >>> PySide2.QtWidgets.QGraphicsAnchorLayout.__signature__ >>> > >>> >     will print all annotations, defaults and return values. >>> > >>> >     The feature supports Python 2.7 and Python 3.4 and up. >>> >     See further info at >>> > >>> >        https://bugreports.qt.io/browse/PYSIDE-510 >>> > >>> > >>> https://github.com/pyside/pyside2-setup/blob/5.6/sources/shiboken2/libshiboken/signature.cpp >>> > >>> > >>> https://github.com/pyside/pyside2-setup/blob/5.6/sources/shiboken2/libshiboken/signature.cpp >>> > >>> >     Cheers -- Chris >>> > >>> >     -- >>> >     Christian Tismer             :^)   tismer at stackless.com >>> >>> >     > >>> >     Software Consulting          :     http://www.stackless.com/ >>> >     Karl-Liebknecht-Str. 121     :     https://github.com/PySide >>> >     14482 Potsdam                :     GPG key -> 0xFB7BEE0E >>> >     phone +49 173 24 18 776  fax +49 (30) 700143-0023 >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> >>> >>> -- >>> Christian Tismer             :^)   tismer at stackless.com >>> >>> Software Consulting          :     http://www.stackless.com/ >>> Karl-Liebknecht-Str. 121     :     https://github.com/PySide >>> 14482 Potsdam                :     GPG key -> 0xFB7BEE0E >>> phone +49 173 24 18 776  fax +49 (30) 700143-0023 >>> >>> >>> >>> >>> >>> >>> >>> _______________________________________________ PySide mailing list >>> PySide at qt-project.org http://lists.qt-project.org/mailman/listinfo/pyside >> >> >> _______________________________________________ >> PySide mailing list >> PySide at qt-project.org >> http://lists.qt-project.org/mailman/listinfo/pyside >> > From tismer at stackless.com Sun Sep 24 17:10:59 2017 From: tismer at stackless.com (Christian Tismer) Date: Sun, 24 Sep 2017 17:10:59 +0200 Subject: [PySide] The Signature Module for PySide2 In-Reply-To: <7324ab8f-6bec-fd65-740e-98c36fb96cda@comcast.net> References: <87098b41-d39f-67b0-12bc-e4367a7b4dc5@stackless.com> <2658af9.153.15ea7fbe6b8.Coremail.redstone-cold@163.com> <71a71ce5.77.15eac9856eb.Coremail.redstone-cold@163.com> <1d123bdc-a38d-fef6-7775-aff43f5de337@comcast.net> <36f07c8d-4194-926a-49ea-1b304389b5fc@stackless.com> <7324ab8f-6bec-fd65-740e-98c36fb96cda@comcast.net> Message-ID: <091c05d9-158f-a929-3410-b0ac7b719254@stackless.com> Oh thanks, you made my day :) I'm used to niche projects, btw. Stackless Python was not very popular as well, but much harder... On 24.09.17 15:59, Bob Hood wrote: > I think introspection is still a fairly uncommon area for most > programmers,even professional software engineers.  Like many things Qt > does, it has leveraged introspection to great benefit, but there's no > requirement to actually know about or understand introspection in order > to use Qt(either via C++ or through PySide).Until it comes as a standard > in a mainstream language,like C++, I don't think you will see widespread > understanding or appreciation of its power. > > And if it's any consolation, I appreciate what you've done, Chris.  :) > > > On 9/23/2017 9:55 PM, Christian Tismer wrote: >> Bob, you are right. The __signature__ object is a true object for >> introspection and you can directly use it to build a function >> call programmatically or find default arguments. Not as strings >> but as life objects. >> >> I think that is a pretty unique feature. I know only of Cython >> who creates signature objects from PyCFunctions. Therefore I expected >> more enthusiastic reactions, the feature was very hard to implement. >> And sure, the doc strings could be derived from it. >> >> Probably I should have pointed people at PEP 362 ff. >> >> Cheers -- Chris >> >> >> On 23.09.17 04:49, Bob Hood wrote: >>> I could be wrong, because I'm not familiar with the "__signature__" >>> attribute, but I believe it is intended to facilitate /introspection/ of >>> classes and methods.  When Christian said "prints", I think he just >>> meant you get to see what the attribute holds, not that it should be >>> used as documentation. >>> >>> You could programmatically access the attributes data, and make run-time >>> use of it.  You can't really do that with the help() output unless you >>> want go to great lengths to parse it. >>> >>> Sorry if I'm way off here. >>> >>> >>> On 9/22/2017 8:36 PM, Zhao Lee wrote: >>>> Sorry, I just feel the feature is just like what help() function do in >>>> Python >>>> https://docs.python.org/3/library/functions.html#help >>>> >>>> an example with PyQt5 >>>>>>> from PyQt5.QtWidgets import QApplication >>>>>>> help(QApplication.startTimer) >>>> Help on built-in function startTimer: >>>> >>>> startTimer(...) >>>>      startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) >>>> -> int >>>> >>>>>>>   >>>> >>>> 在2017年09月22 16时42分, "Christian Tismer"写道: >>>> >>>> >>>>      Hi, >>>> >>>>      please re-submit your reply in a readable way. >>>>      I could read it locally, but the mailing list does not >>>>      have a readable answer from you, just my copied text. >>>> >>>>      Can you please come up with more than just "why not?"? >>>>      I need a proposal how the help should look like. >>>> >>>>      Thanks in advance -- Chris >>>> >>>> >>>>      On 22.09.17 07:07, Zhao Lee wrote: >>>>      > why not? >>>>      >>>> help(PySide2.QtWidgets.QGraphicsAnchorLayout.addAnchors) >>>>      >>>> help(PySide2.QtWidgets.QGraphicsAnchorLayout) >>>>      > >>>>      > >>>>      > >>>>      > 在2017年09月21 21时04分, "Christian Tismer">>>      >写道: >>>>      > >>>>      > >>>>      >     Hi friends, >>>>      > >>>>      >     there is the new signature module for PySide2. >>>>      >     It adds the __signature__ attribute to all PySide2 >>>>      >     functions and constructors. >>>>      > >>>>      >     Example usage: >>>>      > >>>>      >     >>> >>>>      PySide2.QtWidgets.QGraphicsAnchorLayout.addAnchors.__signature__ >>>>      >     >>> PySide2.QtWidgets.QGraphicsAnchorLayout.__signature__ >>>>      > >>>>      >     will print all annotations, defaults and return values. >>>>      > >>>>      >     The feature supports Python 2.7 and Python 3.4 and up. >>>>      >     See further info at >>>>      > >>>>      >        https://bugreports.qt.io/browse/PYSIDE-510 >>>>      > >>>>      > >>>>      >>>> https://github.com/pyside/pyside2-setup/blob/5.6/sources/shiboken2/libshiboken/signature.cpp >>>> >>>>      > >>>>      > >>>>      >>>> https://github.com/pyside/pyside2-setup/blob/5.6/sources/shiboken2/libshiboken/signature.cpp >>>> >>>>      > >>>>      >     Cheers -- Chris >>>>      > >>>>      >     -- >>>>      >     Christian Tismer             :^)   tismer at stackless.com >>>>      >>>>      >     > >>>>      >     Software Consulting          :     http://www.stackless.com/ >>>>      >     Karl-Liebknecht-Str. 121     :     https://github.com/PySide >>>>      >     14482 Potsdam                :     GPG key -> 0xFB7BEE0E >>>>      >     phone +49 173 24 18 776  fax +49 (30) 700143-0023 >>>>      > >>>>      > >>>>      > >>>>      > >>>>      > >>>>      > >>>>      > >>>> >>>> >>>>      -- >>>>      Christian Tismer             :^)   tismer at stackless.com >>>>      >>>>      Software Consulting          :     http://www.stackless.com/ >>>>      Karl-Liebknecht-Str. 121     :     https://github.com/PySide >>>>      14482 Potsdam                :     GPG key -> 0xFB7BEE0E >>>>      phone +49 173 24 18 776  fax +49 (30) 700143-0023 >>>> >>>> >>>> >>>>   >>>> >>>> >>>> _______________________________________________ PySide mailing list >>>> PySide at qt-project.org >>>> http://lists.qt-project.org/mailman/listinfo/pyside >>> >>> >>> _______________________________________________ >>> PySide mailing list >>> PySide at qt-project.org >>> http://lists.qt-project.org/mailman/listinfo/pyside >>> >> > -- Christian Tismer :^) tismer at stackless.com Software Consulting : http://www.stackless.com/ Karl-Liebknecht-Str. 121 : https://github.com/PySide 14482 Potsdam : GPG key -> 0xFB7BEE0E phone +49 173 24 18 776 fax +49 (30) 700143-0023 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 522 bytes Desc: OpenPGP digital signature URL: