Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify int() signature docs #60240

Closed
cjerdonek opened this issue Sep 25, 2012 · 16 comments
Closed

simplify int() signature docs #60240

cjerdonek opened this issue Sep 25, 2012 · 16 comments
Labels
docs Documentation in the Doc dir easy type-feature A feature request or enhancement

Comments

@cjerdonek
Copy link
Member

BPO 16036
Nosy @birkenfeld, @rhettinger, @terryjreedy, @ezio-melotti, @merwok, @cjerdonek, @serhiy-storchaka
Files
  • issue-16036-1-default.patch
  • issue-16036-2-default.patch
  • issue16036.diff
  • issue-16036-4-default.patch
  • issue-16036-5-27.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2012-10-01.04:11:04.080>
    created_at = <Date 2012-09-25.10:18:29.517>
    labels = ['easy', 'type-feature', 'docs']
    title = 'simplify int() signature docs'
    updated_at = <Date 2012-10-07.22:05:29.752>
    user = 'https://github.com/cjerdonek'

    bugs.python.org fields:

    activity = <Date 2012-10-07.22:05:29.752>
    actor = 'python-dev'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2012-10-01.04:11:04.080>
    closer = 'python-dev'
    components = ['Documentation']
    creation = <Date 2012-09-25.10:18:29.517>
    creator = 'chris.jerdonek'
    dependencies = []
    files = ['27294', '27307', '27313', '27321', '27351']
    hgrepos = []
    issue_num = 16036
    keywords = ['patch', 'easy', 'needs review']
    message_count = 16.0
    messages = ['171238', '171259', '171319', '171340', '171349', '171352', '171366', '171393', '171411', '171412', '171596', '171612', '171686', '171690', '171691', '172349']
    nosy_count = 11.0
    nosy_names = ['georg.brandl', 'rhettinger', 'terry.reedy', 'ezio.melotti', 'eric.araujo', 'cvrebert', 'chris.jerdonek', 'docs@python', 'tshepang', 'python-dev', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue16036'
    versions = ['Python 2.7', 'Python 3.2', 'Python 3.3']

    @cjerdonek
    Copy link
    Member Author

    This issue is to simplify the documentation of the built-in function int()'s signature:

    int([number | string[, base]])

    and to make any needed changes to the text of the docs as a consequence. Discussion around this issue began in the comments to bpo-14783 about int() and str()'s docstrings.

    [I copied the nosy list from that issue.]

    @cjerdonek cjerdonek added docs Documentation in the Doc dir easy type-feature A feature request or enhancement labels Sep 25, 2012
    @cjerdonek
    Copy link
    Member Author

    [Continuing the bpo-14783 discussion]

    That said, I don't have a strong opinion about this, so if people think that x should be used, it's fine with me.

    I also feel that *x* should be used, since that is what the code enforces.

    I'm attaching a revised patch. This patch also makes related adjustments to the corresponding text.

    @cjerdonek
    Copy link
    Member Author

    I'm attaching an updated patch that does not cover certain edge cases that may differ for other Python implementations (and in fact does differ for PyPY).

    See bpo-16045 for more information.

    @ezio-melotti
    Copy link
    Member

    The latest patch is better, however I think it can be further improved.

    The text is currently divided in two paragraphs:

    1. covers int(), int(num), int(x, base=b);
    2. covers int(float), and int(x, base=b);

    I think it would be better to cover first int(), int(num), int(float), and then cover int(x, base=b). The attached patch does this.

    @merwok
    Copy link
    Member

    merwok commented Sep 26, 2012

    Latest patch LGTM.

    @cjerdonek
    Copy link
    Member Author

    Good improvement. LGTM.

    @cjerdonek
    Copy link
    Member Author

    Ezio, do you want to commit this or should I?

    @cjerdonek
    Copy link
    Member Author

    Attaching updated patch that clarifies the accepted non-numeric types as Serhiy suggested on Rietveld.

    I also made a few other changes like linking to "integer literal" and updating the "base-radix" reference. As I began to suspect, the latter was left over from a prior version of the docs (when the keyword argument was named "radix"):

    http://hg.python.org/cpython/file/18db8c4d4487/Doc/library/functions.rst#l559

    I will commit later today unless there are further suggestions.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 28, 2012

    New changeset 9205277bc008 by Chris Jerdonek in branch '3.2':
    Issue bpo-16036: Improve documentation of built-in int()'s signature and arguments.
    http://hg.python.org/cpython/rev/9205277bc008

    New changeset 6ccb04c4cbae by Chris Jerdonek in branch 'default':
    Issue bpo-16036: Merge update from 3.2.
    http://hg.python.org/cpython/rev/6ccb04c4cbae

    @cjerdonek
    Copy link
    Member Author

    Leaving open until the change is made in 2.7 (the current wording is somewhat different there). I will do that in the next day or so.

    @cjerdonek
    Copy link
    Member Author

    See the following comment to bpo-16045 for a couple differences in the behavior of int() in 2.7:

    http://bugs.python.org/issue16045#msg171595

    @cjerdonek
    Copy link
    Member Author

    Attaching patch updated for backport to 2.7.

    In cases where the 2.7 language was substantively different, I preserved the 2.7 language (e.g. I preserved the reference to plain and long integers). I also added the lone "0" prefix for octals, which is a difference from 3.x: 0o/0O/0.

    @cjerdonek
    Copy link
    Member Author

    [Django/Rietveld is erroring out for me when I try to reply there, so replying here]

    On 2012/10/01 01:45:03, cvrebert wrote:

    Doc/library/functions.rst:636: arguments are given. If *x* is a number, return
    :meth:`x.__int__()
    How is "number-ness" determined? Are we just assuming anything with an __int__()
    method is a number for purposes of explanation?

    cvrebert, this patch has already been committed to 3.x. Maybe open a new issue if you think the language can be improved further? (Feel free to add me to the nosy list.) This issue was originally focused more on updating just the signature line (along with any consequent changes to the text).

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 1, 2012

    New changeset ed76eac4491e by Chris Jerdonek in branch '2.7':
    Close bpo-16036: Backport 3.x documentation improvement.
    http://hg.python.org/cpython/rev/ed76eac4491e

    @python-dev python-dev mannequin closed this as completed Oct 1, 2012
    @cjerdonek
    Copy link
    Member Author

    Chris (cvrebert), feel free to create a new issue to improve the int() docs further.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 7, 2012

    New changeset e4598364ea29 by Chris Jerdonek in branch '3.2':
    Issue bpo-14783: Improve int() docstring and also str(), range(), and slice().
    http://hg.python.org/cpython/rev/e4598364ea29

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    docs Documentation in the Doc dir easy type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants