I'd like to take your opinion on modifying some of the indexed collections like 
tuples, lists, arrays to evaluate its equality to True when having the same 
items in the same indexes.
Currently, when comparing a list of items to an array of the same items for 
equality (==)  it returns False, I'm thinking that it would make sense to 
return True in that context, as we're comparing item values and we have the 
same way of indexing both collections, so we can compare item values.

So what do you think about applying such behavior on collections that can be 
indexed the same way such as tuples, lists, and arrays?

Example: (Current)

import array
tuple_ = (1.1, 2.2, 3.3)
list_ = [1.1, 2.2, 3.3]
array_ = array.array('f', [1.1, 2.2, 3.3])

# all of the following prints False.
print(tuple_ == list_)
print(tuple_ == array_) 
print(array_ == list_) 

Example: (Proposed):
All prints above to show True as they are populated with the same data in the 
same indexes.

A Side Note:
An extra point to discuss, based on arrays implementation, array_.to_list() 
would actually get [1.100000023841858, 2.200000047683716, 3.299999952316284] 
which is not exactly what we've passed as args and this is normal, but I'm 
thinking about leaving it to the array implementation to encapsulate that 
implementation and perform exact equality based on passed arguments.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/UE5HGECRTS3ERK5OMG3GB77EKSAFJV7R/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to