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

Update demo files #82720

Closed
ju-sh mannequin opened this issue Oct 20, 2019 · 7 comments
Closed

Update demo files #82720

ju-sh mannequin opened this issue Oct 20, 2019 · 7 comments
Assignees
Labels
3.9 only security fixes type-feature A feature request or enhancement

Comments

@ju-sh
Copy link
Mannequin

ju-sh mannequin commented Oct 20, 2019

BPO 38539
Nosy @rhettinger, @ju-sh
PRs
  • bpo-38539: update demo files #16890
  • bpo-38539: Finish rename of ss1.py to spreadsheet.py #16896
  • 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 = 'https://github.com/rhettinger'
    closed_at = <Date 2019-10-23.03:24:08.639>
    created_at = <Date 2019-10-20.19:17:35.080>
    labels = ['type-feature', '3.9']
    title = 'Update demo files'
    updated_at = <Date 2019-10-23.04:05:10.877>
    user = 'https://github.com/ju-sh'

    bugs.python.org fields:

    activity = <Date 2019-10-23.04:05:10.877>
    actor = 'rhettinger'
    assignee = 'rhettinger'
    closed = True
    closed_date = <Date 2019-10-23.03:24:08.639>
    closer = 'rhettinger'
    components = ['Demos and Tools']
    creation = <Date 2019-10-20.19:17:35.080>
    creator = 'ju-sh'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38539
    keywords = ['patch']
    message_count = 7.0
    messages = ['355013', '355014', '355094', '355111', '355137', '355205', '355207']
    nosy_count = 2.0
    nosy_names = ['rhettinger', 'ju-sh']
    pr_nums = ['16890', '16896']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue38539'
    versions = ['Python 3.9']

    @ju-sh
    Copy link
    Mannequin Author

    ju-sh mannequin commented Oct 20, 2019

    The demo programs inside Tools/demo, which is to guide people new to the language (that's the purpose, right?), makes use of several bad coding practices.

    Like

    • `while 1:` being used instead of `while True:`
    • star import
    • function call and an `if` statement being on the same line, etc.

    It can easily mislead someone new to the language especially since it is part of the codebase and part of distribution as well.

    Can we update these files? Most of these seem have not been updated in some time.

    A discussion touching this problem on #python-dev suggested that the demos were written when the docs were yet to be polished and now that we have a fully fledged documentation, maybe the demo files can be dropped.

    But since the bpo has an option 'Demos and tools' under 'components', I guess maybe the demos are still considered essential.

    What do you all think?

    @ju-sh ju-sh mannequin added 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes type-feature A feature request or enhancement labels Oct 20, 2019
    @rhettinger
    Copy link
    Contributor

    The Tools/demo modules are sort of a quaint museum to the past. That said, most of the code reads fine even by today's standards.

    Go ahead with as PR to change "while 1" to "while True".

    The star imports should remain (they are the norm for Tkinter) code.

    Let's don't reformat the if/action pairs on the same line. That reflects the author's way of thinking about the problem. Though it may offend your stylistic sensibilities, it is valid Python and readable enough.

    BTW, the scripts are almost never "guide people new to the language". They are typically only found by experienced programmers exploring the tree of code (like little easter eggs).

    @rhettinger rhettinger removed 3.7 (EOL) end of life 3.8 only security fixes labels Oct 20, 2019
    @rhettinger rhettinger self-assigned this Oct 20, 2019
    @ju-sh
    Copy link
    Mannequin Author

    ju-sh mannequin commented Oct 21, 2019

    Okay. While I'm at it, can I make a few minor change as well? Like

    • Use fstrings
    • change range(0, val) to range(val) as range()'s first argument has default value 0.
    • Change `for i in range(len(groups)):` to enumerated (redemo.py)
    • rename ss1.py to spreadsheet.py (to make its purpose clearer)

    @rhettinger
    Copy link
    Contributor

    Let's just do the rename for ss1.py.

    @ju-sh
    Copy link
    Mannequin Author

    ju-sh mannequin commented Oct 22, 2019

    I've made a PR. Can you review it?

    @rhettinger
    Copy link
    Contributor

    New changeset a4aeb33 by Raymond Hettinger (Julin S) in branch 'master':
    bpo-38539: Update demo files (GH-16890)
    a4aeb33

    @rhettinger
    Copy link
    Contributor

    New changeset ea6041c by Raymond Hettinger in branch 'master':
    bpo-38539: Finish rename of ss1.py to spreadsheet.py (GH-16896)
    ea6041c

    @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
    3.9 only security fixes type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant