[Python-ideas] Proposal: Use mypy syntax for function annotations
Łukasz Langa
lukasz at langa.pl
Thu Aug 14 05:16:04 CEST 2014
On Aug 13, 2014, at 8:08 PM, Andrew Barnert <abarnert at yahoo.com> wrote:
> On Aug 13, 2014, at 18:56, Łukasz Langa <lukasz at langa.pl> wrote:
>
>> One of my big dreams about Python is that one day we'll drop support for strings being iterable. Nothing of value would be lost and that would enable us to use isinstance(x, Iterable) and more importantly isinstance(x, Sequence). Funny that this surfaces now, too.
>
> IIRC, str doesn't implement Container, and therefore doesn't implement Sequence, because its __contains__ method is substring match instead of containment. So if you really want to treat sequences of strings separately from strings, you can.
str and bytes objects respond True to both isinstance(x, Container) and isinstance(x, Sequence).
But you’re right, off topic.
--
Best regards,
Łukasz Langa
WWW: http://lukasz.langa.pl/
Twitter: @llanga
IRC: ambv on #python-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140813/7dad0859/attachment.html>
More information about the Python-ideas
mailing list