On Sun, Jun 25, 2017 at 8:47 PM, Lucas Wiman <lucas.wi...@gmail.com> wrote:

> > ​Yes, but then `isinstance(tuple(range(1000000)), Tuple[int, ...])`
> would be a difficult case.
>
> Yes, many methods on million-element tuples are slow. :-)
>
> Python usually chooses the more intuitive behavior over the faster
> behavior when there is a choice. IIUC, the objections don't have anything
> to do with speed.
>
>
​Sure, performance cannot dictate everything. But if you look at, for
example, that multidispatch example I wrote in the OP, it would not be wise
to do that expensive check every time. Also, people don't expect an
isinstance check to be expensive. But looking at annotations, it is often
possible to get the desired answer without checking all elements in a tuple
(or especially without consuming generators etc. to check the types).

-- Koos
​
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to