Re: [Python-ideas] Conventions for function annotations

Sorry, should have gone to the list On 3 December 2012 09:30, Paul Moore <p.f.moore@gmail.com> wrote:

The IPython community has thought of using annotations to do argument specific tab completion in the interactive interpreter. For example, a load function whose first argument is supposed to be files matching a certain glob pattern might use a function annotation on that argument to specify the glob pattern. A sympy maintainer, Aaron Meurer, has also expressed interest in using this feature -- as implemented in ipython -- to annotate sympy functions' return values by type to facilitate tab completion for chained calls like f(x).<TAB> I'm working on this feature for IPython (PR: Function annotation based hooks into the tab completion system). I've already benefited a lot from the discussion on this thread in terms of the design of the API. Specifically Nick Coghlan's arguments have been very enlightening. Comments, suggestions, contributions, etc are welcome! -Robert On Dec 3, 2012, at 1:30 AM, Paul Moore wrote:

On 3 December 2012 09:30, Paul Moore <p.f.moore@gmail.com> wrote:
.. but haven't thought of any other useful applications of annotations, and nor has the collective community on PyPI.
I suspect that the lack of applications is partly due to people not knowing about them, code having to still support Python 2, and an absence of guidelines about how to use them safely. For our part, I think we'll push forwards following Nick's suggestions - annotations to be accessed by closely coupled decorators only. Thanks all, Thomas

The IPython community has thought of using annotations to do argument specific tab completion in the interactive interpreter. For example, a load function whose first argument is supposed to be files matching a certain glob pattern might use a function annotation on that argument to specify the glob pattern. A sympy maintainer, Aaron Meurer, has also expressed interest in using this feature -- as implemented in ipython -- to annotate sympy functions' return values by type to facilitate tab completion for chained calls like f(x).<TAB> I'm working on this feature for IPython (PR: Function annotation based hooks into the tab completion system). I've already benefited a lot from the discussion on this thread in terms of the design of the API. Specifically Nick Coghlan's arguments have been very enlightening. Comments, suggestions, contributions, etc are welcome! -Robert On Dec 3, 2012, at 1:30 AM, Paul Moore wrote:

On 3 December 2012 09:30, Paul Moore <p.f.moore@gmail.com> wrote:
.. but haven't thought of any other useful applications of annotations, and nor has the collective community on PyPI.
I suspect that the lack of applications is partly due to people not knowing about them, code having to still support Python 2, and an absence of guidelines about how to use them safely. For our part, I think we'll push forwards following Nick's suggestions - annotations to be accessed by closely coupled decorators only. Thanks all, Thomas
participants (3)
-
Paul Moore
-
Robert McGibbon
-
Thomas Kluyver