On 07/07/2013 07:19 AM, Ronald Oussoren wrote:
Not entirely on topic, but close enough: pydoc currently doesn't use the __signature__ information at all. Adding such support would be easy enough, see #17053 for an implementation ;-)

True, it doesn't use inspect.signature, it uses inspect.getfullargspec. Since I don't propose modifying inspect.getfullargspec to add the optional parameter group information, 17053 or something like it would have to happen.


On 07/07/2013 07:25 AM, R. David Murray wrote:
Sorry to make your life more complicated, but unless I'm misunderstanding
something, issue 18220 (http://bugs.python.org/issue18220) throws another
monkey-wrench in to this.  If I'm understanding this discussion correctly,
that example:

     islice(stop)
     islice(start, stop [, step])

requires the multiple-signature approach.

Note also that the python3 documentation has moved away from the []
notation wherever possible.

It depends on what problem you're addressing. In terms of the Argument Clinic DSL, and in terms of the static introspection information stored for builtins, someone (Nick?) suggested a refinement to the semantics: in the face of ambiguity, prefer the leftmost group(s) first. That means that range() and islice() could be specified as follows:

   range([start,] stop, [step])


In terms of the documentation, it might be better to preserve the multiple-lines approach, as perhaps that's more obvious to the reader. On the other hand: in Python 3, help(itertools.islice) uses solely the optional group syntax, on one line.


On 07/07/2013 07:25 AM, Ronald Oussoren wrote:
Signature objects use a name in angled brackets to indicate that a parameter is positional only, for 
example "input(<prompt>)". That might be an alternative to adding a "/" in the 
argument list in pydoc's output.

I wasn't aware that Signature objects currently had any support whatsoever for positional-only parameters. Yes, in theory they do, but in practice they have never seen one, because positional-only parameters only occur in builtins and Signature objects have no metadata for builtins. (The very problem Argument Clinic eventually hopes to solve!)

Can you cite an example of this, so I may examine it?


//arry/
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to