On Sep 4, 2019, at 20:51, Inada Naoki <songofaca...@gmail.com> wrote:

>> And you’re right, because int|str _looks_ better than (int, str) here, many 
>> people will be encouraged to use it even though it’s slower, which could 
>> potentially be a bad thing for some programs.
> 
> That's exactly my point.  If we say "you can use `isinstance(x, int |
> str)` for now", people
> may think it is a new and recommended way to write it.

Right; I was agreeing, and saying it may even be worse than you’re suggesting. 
There’s always the possibility that any shiny new feature looks like the One 
True Way and gets overused. But in this case, it looks more obviously right 
even to someone who’s not interested in shiny new features and has never heard 
the word “pythonic” or read a new version’s release notes. So they’re going to 
use it. Which means if they run into a situation where they’re checking types 
of a zillion objects, they’re definitely not going to guess that it’s 5x as 
slow, so there definitely going to misuse it.
_______________________________________________
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/X7FZ3P6OJ3TM6OFS527N27DNKYWENOOU/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to