On Dec 3, 2019, at 20:45, Steven D'Aprano <st...@pearwood.info> wrote:
> 
> 1. A lot of collections define element equality using an identity test 
> first as an optimization (even if that means that they do the wrong 
> thing when NANs are involved). So that's prima facie evidence that using 
> `is` will be faster.

No, that’s the point. If the type already does an identity test first, doing an 
extra identity test first will probably be slower. Certainly it will if they 
aren’t identical, but even if they are, there’s the cost of the extra “or” 
opcodes (at least if the type is a builtin).
_______________________________________________
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/MAZKEVPUN5AQ5RES7IVHB3L3VAZHGTLT/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to