On Tue, May 5, 2020 at 7:36 AM Raymond Hettinger < raymond.hettin...@gmail.com> wrote:
> >> Isn't a tuple essentially just a frozenlist? I know the intended > >> semantics of tuples and lists tend to be different, but I'm not sure > that's > >> relevant. > > > In terms of API, it might look that way. But in terms of use cases, they > are less alike: lists-are-looping, tuples-are-for-nonhomongenous-fields. > List are like database tables; tuples are like records in the database. > Lists are like C arrays; tuples are like structs. > Right, that's what I'm referring to. If you're comparing two things which are meant to represent completely different entities (say, comparing a record to a table) then your code is probably completely broken (why would you be doing that?) and having equality return False isn't going to fix that. Conversely I can't see how returning True could break a program that would work correctly otherwise. If you're comparing a list and a tuple, and you haven't completely screwed up, you probably mean to compare the elements and you made a small mistake, e.g. you used the wrong brackets, or you forgot that *args produces a tuple.
_______________________________________________ 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/3NYG6HCBEHWT44HBLWYVF5W3FKN3L27Y/ Code of Conduct: http://python.org/psf/codeofconduct/