On Fri, May 08, 2020 at 03:12:10PM -0400, Dan Sommers wrote: > On Sat, 9 May 2020 03:39:53 +1000 > Steven D'Aprano <st...@pearwood.info> wrote: > > > This proposal is a narrow one: its the same as list or tuple equality, > > but duck-typed so that the container type doesn't matter. > > Okay. Good. > > "Container," however, is a dangerous word in this context. According to > https://docs.python.org/3/library/stdtypes.html, lots of things are > "conrtainers." Can they all be sequence-equal to each other?
All(?) sequences are containers, but not all containers are sequences, so no. > Of particular note might be sets, which don't have an inherent order. I > am in no way proposing that sequence-equal be extended to cover sets, > which by definition can't really be a sequence. This is a very good question, thank you. I think that this ought to exclude mappings and sets, at least initially. Better to err on the side of caution than to overshoot by adding too much and then being stuck with it. The primary use-case here is for sequences. Comparisons between sets and sequences are certainly possible, but one has to decide on a case-by-case basis what you mean. For example, are these equal? {1, 2} and (1, 1, 2) I don't know and I don't want to guess, so leave it out. -- Steven _______________________________________________ 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/FSDHL7WAFYCRGK2P5RYQNWCI63CALWKY/ Code of Conduct: http://python.org/psf/codeofconduct/