[docs] [issue15831] comma after leading optional argument is after bracket in docs

Chris Jerdonek report at bugs.python.org
Mon Sep 3 00:33:56 CEST 2012

Chris Jerdonek added the comment:

Attaching a proposed patch for the default branch.  Also, here are several comments and questions.

> I think/hope that all the APIs we have in the stdlib are sane enough to have no more than 2-3 signatures

I found this one in the curses module with four:

window.chgat(num, attr)
window.chgat(y, x, attr)
window.chgat(y, x, num, attr)

Do we like how these look?  Is the bare star notation too obscure?

inspect.Signature.replace(*[, parameters][, return_annotation])
inspect.Parameter.replace(*[, name][, kind][, default][, annotation])

I was curious what the preferred way to display the following is, since I don't think any comma/bracket placement will work:

ArgumentParser([description][, epilog][, prog][, usage][, add_help][, argument_default][, parents][, prefix_chars][, conflict_handler][, formatter_class])

(unless perhaps we use the construction "ArgumentParser(*[, description][, epilog]....")

I'm not sure how we want to handle this one using multiple signatures:

multiprocessing.Process([group[, target[, name[, args[, kwargs]]]]], *, daemon=None)

I put my preferred rendering in the patch, but Sphinx re-renders it in its own way.

I also noticed these more unusual signatures:

urllib.request.urlopen(url, data=None[, timeout], *, cafile=None, capath=None, cadefault=True)
http.client.HTTPSConnection(host, port=None, key_file=None, cert_file=None[, strict[, timeout[, source_address]]], *, context=None, check_hostname=None)

By the way, is the * really necessary in these examples?

keywords: +needs review, patch
stage: needs patch -> patch review
Added file: http://bugs.python.org/file27104/issue-15831-1.patch

Python tracker <report at bugs.python.org>

More information about the docs mailing list