On Tue, Aug 10, 2021 at 12:03 AM Simão Afonso <simao.afo...@powertools-tech.com> wrote: > > On 2021-08-09 23:57:42, Chris Angelico wrote: > > On Mon, Aug 9, 2021 at 10:32 PM Samuel Freilich <sfreil...@google.com> > > wrote: > > > Even without it being used in as complicated a way as that it's still not > > > backward compatible because of the trivial case, as foo.endswith("") is > > > True. > > > > I was talking specifically about the original, which can be depended > > upon to return True or False. Changing the return value would break > > anything that depends on that. > > > > Not sure what you're referring to. > > I think this is the problem: > > > >>> "str".endswith("") is True > > True > > >>> "" is True > > <stdin>:1: SyntaxWarning: "is" with a literal. Did you mean "=="? > > False > > Even if you use the return value as a bool, it will flip the result.
Yep, that's also a problem, but I don't understand why my comment about "can be used eg for indexing" was being quoted for context there. I was talking about how you could do something like this: protocol = ("ws:", "wss:")[url.startswith("https:")] If the return value changes, this breaks. ChrisA _______________________________________________ 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/EMTRLSZTJMTDFV7JFXOJR3KIT4YEOMLU/ Code of Conduct: http://python.org/psf/codeofconduct/