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

ValueError using index on tuple is not showing the tuple value #83680

Closed
tuxskar mannequin opened this issue Jan 30, 2020 · 2 comments
Closed

ValueError using index on tuple is not showing the tuple value #83680

tuxskar mannequin opened this issue Jan 30, 2020 · 2 comments
Labels
3.8 only security fixes type-bug An unexpected behavior, bug, or error

Comments

@tuxskar
Copy link
Mannequin

tuxskar mannequin commented Jan 30, 2020

BPO 39499
Nosy @tirkarthi, @tuxskar
Superseder
  • bpo-13349: Non-informative error message in index() and remove() functions
  • 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 2020-01-30.09:03:41.752>
    created_at = <Date 2020-01-30.07:41:48.457>
    labels = ['type-bug', '3.8']
    title = 'ValueError using index on tuple is not showing the tuple value'
    updated_at = <Date 2020-01-30.09:03:41.749>
    user = 'https://github.com/tuxskar'

    bugs.python.org fields:

    activity = <Date 2020-01-30.09:03:41.749>
    actor = 'xtreak'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-01-30.09:03:41.752>
    closer = 'xtreak'
    components = []
    creation = <Date 2020-01-30.07:41:48.457>
    creator = 'tuxskar'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 39499
    keywords = []
    message_count = 2.0
    messages = ['361016', '361025']
    nosy_count = 2.0
    nosy_names = ['xtreak', 'tuxskar']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '13349'
    type = 'behavior'
    url = 'https://bugs.python.org/issue39499'
    versions = ['Python 3.8']

    @tuxskar
    Copy link
    Mannequin Author

    tuxskar mannequin commented Jan 30, 2020

    When trying to retrieve the index of an element that is not in a tuple the error message of ValueError is not showing the value looking for but instead a static message tuple.index(x): x not in tuple

    >>> b = (1, 2, 3, 4)
    >>> b.index(5)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ValueError: tuple.index(x): x not in tuple
    
    I would expect something like what happen in lists where the element (5 in this case) is showed on the ValueError.
    >>> a = [1, 2, 3, 4]
    >>> a.index(5)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ValueError: 5 is not in list

    @tuxskar tuxskar mannequin added 3.8 only security fixes labels Jan 30, 2020
    @tirkarthi
    Copy link
    Member

    This is a duplicate of bpo-33560. See also bpo-13349 which is the original duplicate.

    @tirkarthi tirkarthi added the type-bug An unexpected behavior, bug, or error label Jan 30, 2020
    @tirkarthi tirkarthi added the type-bug An unexpected behavior, bug, or error label Jan 30, 2020
    @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.8 only security fixes type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant