New submission from Hardik <hardik...@gmail.com>:

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

----------
components: Tests
messages: 338906
nosy: HardikPatel
priority: normal
severity: normal
status: open
title: Different ValueError for the same operation in List and Tuple
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36442>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to