This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ezio.melotti
Recipients asvetlov, chris.jerdonek, docs@python, eric.araujo, ezio.melotti, georg.brandl
Date 2012-09-04.13:10:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1346764230.3.0.214391624231.issue15831@psf.upfronthosting.co.za>
In-reply-to
Content
> 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])

Note that if possible, it's better to avoid using the [] and put the default values.  However, in these cases the default value seems to be a _void placeholder.

The star notation is OK, since it's valid Python.


> 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])

If the default values are known you could use them, otherwise this signature looks OK to me.

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

This is OK too, as long as all the arguments (including 'description') are keyword-only.

> I'm not sure how we want to handle this one using multiple signatures:
>
> multiprocessing.Process([group[, target[, name[, args[, kwargs]]]]], *, daemon=None)

This is OK too.

> 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)

Here the args between [] probably have a placeholder default, or are obtained from somewhere else (e.g. from socket.getdefaulttimeout()).  These signature, albeit a bit weird, are understandable IMHO, so, unless you find a better way to write them, I would leave them as they are.

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

If the args on the right of the * are keyword-only and the one on the left aren't, then yes.
History
Date User Action Args
2012-09-04 13:10:30ezio.melottisetrecipients: + ezio.melotti, georg.brandl, eric.araujo, asvetlov, chris.jerdonek, docs@python
2012-09-04 13:10:30ezio.melottisetmessageid: <1346764230.3.0.214391624231.issue15831@psf.upfronthosting.co.za>
2012-09-04 13:10:29ezio.melottilinkissue15831 messages
2012-09-04 13:10:28ezio.melotticreate