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

Different ValueError for the same operation in List and Tuple #80623

Closed
HardikPatel mannequin opened this issue Mar 26, 2019 · 5 comments
Closed

Different ValueError for the same operation in List and Tuple #80623

HardikPatel mannequin opened this issue Mar 26, 2019 · 5 comments
Labels
3.8 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement

Comments

@HardikPatel
Copy link
Mannequin

HardikPatel mannequin commented Mar 26, 2019

BPO 36442
Nosy @larryhastings, @serhiy-storchaka, @tirkarthi
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 2019-03-31.17:10:26.651>
    created_at = <Date 2019-03-26.17:11:24.906>
    labels = ['interpreter-core', 'type-feature', '3.8']
    title = 'Different ValueError for the same operation in List and Tuple'
    updated_at = <Date 2019-03-31.17:10:26.651>
    user = 'https://bugs.python.org/HardikPatel'

    bugs.python.org fields:

    activity = <Date 2019-03-31.17:10:26.651>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-03-31.17:10:26.651>
    closer = 'serhiy.storchaka'
    components = ['Interpreter Core']
    creation = <Date 2019-03-26.17:11:24.906>
    creator = 'HardikPatel'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 36442
    keywords = []
    message_count = 5.0
    messages = ['338906', '338910', '339262', '339267', '339270']
    nosy_count = 5.0
    nosy_names = ['larry', 'SilentGhost', 'serhiy.storchaka', 'xtreak', 'HardikPatel']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '13349'
    type = 'enhancement'
    url = 'https://bugs.python.org/issue36442'
    versions = ['Python 3.8']

    @HardikPatel
    Copy link
    Mannequin Author

    HardikPatel mannequin commented Mar 26, 2019

    I am curious why ValueErrors are different in List and Tuple when I try to get an index.  ValueError of a list returns in well format with actual argument "ValueError: 'ITEM' is not in list", whereas tuple returns something like this "ValueError: tuple.index(x): x not in tuple". 
    I think List and Tuple both are calling same index() method then why it is raising different ValueErrors? 
    >>> jframe_li
    ['Angular', 'React', 'Vue.js', 'Ember.js', 'Mereor', 'Node.js', 'Backbone.js']
    >>> jframe_tu
    ('Angular', 'React', 'Vue.js', 'Ember.js', 'Mereor', 'Node.js', 'Backbone.js')
    >>> jframe_li.index('React')
    1
    >>> jframe_tu.index('React')
    1
    >>> jframe_li.index('react')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ValueError: 'react' is not in list
    
    >>> jframe_tu.index('react')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ValueError: tuple.index(x): x not in tuple

    @HardikPatel HardikPatel mannequin added tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error 3.7 (EOL) end of life labels Mar 26, 2019
    @SilentGhost SilentGhost mannequin added interpreter-core (Objects, Python, Grammar, and Parser dirs) and removed tests Tests in the Lib/test dir labels Mar 26, 2019
    @SilentGhost
    Copy link
    Mannequin

    SilentGhost mannequin commented Mar 26, 2019

    This seems to be related to argument clinic work (bpo-20186 and bpo-20185).

    @serhiy-storchaka
    Copy link
    Member

    Thus is definitely is not related to Argument Clinic.

    And seems that this issue is a duplicate of an old issue with a long discussion and an unfinished patch, but currently I cannot find that issue.

    @serhiy-storchaka serhiy-storchaka added 3.8 only security fixes type-feature A feature request or enhancement and removed topic-argument-clinic 3.7 (EOL) end of life type-bug An unexpected behavior, bug, or error labels Mar 31, 2019
    @tirkarthi
    Copy link
    Member

    And seems that this issue is a duplicate of an old issue with a long discussion and an unfinished patch, but currently I cannot find that issue.

    possibly duplicate of bpo-13349 which was rejected ?

    @serhiy-storchaka
    Copy link
    Member

    Yes, it is. Thank you Karthikeyan!

    @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 interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants