On Tue, Aug 31, 2021 at 6:52 AM Nick Parlante <n...@cs.stanford.edu> wrote: > > I claimed that uses of "is" where it is needed for correctness > are quite rare. Let me back that up with a little data here. > > Just as a random supply of Python code, let's look at > the first four Python modules where the name starts > with a letter from the Python standard modules list > https://docs.python.org/3/py-modindex.html : > abc.py aifc.py argparse.py ast.py (The array module appears to be in C) > > Strip out PyDoc and string literals and just grep > for " is " (code included below if you'd like to try > it yourself). Look at those lines - how many of those > uses of "is" are needed for correctness, where the "is" > is really doing something, and how many would work > fine with ==? The resulting lines of code are included below. > > There's about 90 uses of is/is-not in this sample. > 100% of these uses would work correctly using ==. > Not a single one of these uses actually relies on the "is" > computation for correctness.
On what basis do you ascertain whether "==" would work correctly? Please explain. 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/5LM3UMQXPEXWGUPHPGMN2NQSDOJZ2LEZ/ Code of Conduct: http://python.org/psf/codeofconduct/