On Mon, Aug 30, 2021, 15:38 Nick Parlante <n...@cs.stanford.edu> wrote:

> Hi Chris - thanks for the response,
>
> so here you say:
>
> I disagree; experienced programmers should be using "is" where it's
>> correct.
>>
>
> I think PEP8 has forced people to use "is" so much, they've lost touch
> with the reality that in fact == would work perfectly in almost all cases.
> Situations where "is" is required for correctness are very rare.
>

For you. For me, x==None failing is by far the most common scenario. That
is because I do a lot of numeric programming and the only place I am likely
to test for None is when setting a default input for a mutable value, which
is an array-like most of the time. And numeric programming is one of the
most common python use-cases so it isn't like that can just be ignored.

And it isn't just numeric programming.  There is an enormous number of
different ways == is modified. But you can't change "is" in any reasonably
simple way.

The great thing about python duck-typing is that you often don't need to
care about what your inputs are. But it also means you shouldn't make your
code needlessly brittle so it only works properly with a handful of stdlib
types.

>
_______________________________________________
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/WBN7HI732TR2RMAAWSAIB3CWZMQS4CTQ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to