Skip to content

optparse.py:1668: (file) shadows builtin #70152

Description

@mmokrejs
mannequin
BPO 25964

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 2015-12-28.10:16:14.522>
created_at = <Date 2015-12-28.10:09:18.072>
labels = ['invalid', 'type-bug', 'library']
title = 'optparse.py:1668: (file) shadows builtin'
updated_at = <Date 2015-12-28.10:24:40.971>
user = 'https://bugs.python.org/mmokrejs'

bugs.python.org fields:

activity = <Date 2015-12-28.10:24:40.971>
actor = 'SilentGhost'
assignee = 'none'
closed = True
closed_date = <Date 2015-12-28.10:16:14.522>
closer = 'SilentGhost'
components = ['Library (Lib)']
creation = <Date 2015-12-28.10:09:18.072>
creator = 'mmokrejs'
dependencies = []
files = []
hgrepos = []
issue_num = 25964
keywords = []
message_count = 4.0
messages = ['257110', '257112', '257113', '257114']
nosy_count = 2.0
nosy_names = ['mmokrejs', 'SilentGhost']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue25964'
versions = ['Python 2.7']

Activity

  1. mmokrejs commented on Dec 28, 2015

    mmokrejsmannequin
    MannequinAuthor

    I use pychecker for checking my python code. Seems optparse.py distributed with python-2.7 could be improved as well:

    [system path]/optparse.py:1191: Function (init) has too many arguments (11)
    [system path]/optparse.py:1206: Local variable (version) shadows global defined on line 10 in file my-test-code.py
    [system path]/optparse.py:1400: Local variable (stop) not used
    [system path]/optparse.py:1668: (file) shadows builtin

    Interestingly, my version variable is overridden by one from optparse.py. But more worrisome is the 'file' variable name.

  2. SilentGhost commented on Dec 28, 2015

    SilentGhostmannequin
    Mannequin

    None of this warnings highlights a real issue. Furthermore, optparse module is deprecated and you'd be better off using argparse instead.

  3. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Dec 28, 2015
  4. added
    type-bugAn unexpected behavior, bug, or error
    and removed
    type-featureA feature request or enhancement
    on Dec 28, 2015
  5. mmokrejs commented on Dec 28, 2015

    mmokrejsmannequin
    MannequinAuthor

    But couldn't somebody just rename the variable for example to _file? I see optparse also in python-3.5 so I did not think it could be Deprecated.

  6. SilentGhost commented on Dec 28, 2015

    SilentGhostmannequin
    Mannequin

    The deprecation warning is clearly displayed at the top of the module documentation: https://docs.python.org/3/library/optparse.html

    Regarding variable names: it is not an issue and pychecker is simply mistaken here.

  7. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions