Is there a reason mypy could not assume that all AtomicStr methods that return strings actually return an AtomicStr, without impacting runtime behavior...? Maybe it's not possible and I'm just not familiar enough with the behavior of the type checkers.

I don't know but I could say that being problematic if parts of a project expects strings to be iterable and some expect them to atomic. 

If mypy assumes `isinstance(obj, Iterable)` returns false on `str` then its not really helping in the case where `obj: Union[str, Iterable[str]]`

And while I don't really know much about mypy, I do know it understands stuff like `if isisnstance`, it seems like it would take tremendous hackery to get it to understand that when `isinstance(obj, Iterable)` returns True, you still can't pass that object to a function that consumes an iterable without also checking `not isinstance(obj, (str, bytes))`.

assert """
In practice this would be a very odd decision given that the definition of Iterable is "has an __iter__". And there are plenty of times people will find the resulting behavior surprising since str DOES have an __iter__ method and there are plenty of times you might want to iterate on sequences and strs in the same context.
""" in set_of_draw_backs

On Tue, Feb 25, 2020 at 4:28 AM Rhodri James <rhodri@kynesim.co.uk> wrote:
On 24/02/2020 21:07, Alex Hall wrote:
> This response honestly seems to ignore most of the paragraph that it's
> responding to. It being a sharp distinction doesn't matter because
> consistency isn't axiomatically valuable.

Actually I think it is.  Or more precisely, I think inconsistency is
axiomatically has negative value.  An inconsistency breaks your
expectation of how a language works.  Each inconsistency creates a
special case that you simply have to learn in order to use the language.
  The more inconsistencies you have, the more of those exceptions you
have to know, and the harder the language is to learn.  Just consider
how hard English is to learn as an adult, and notice just how much of
the language is inconsistency after inconsistency.

--
Rhodri James *-* Kynesim Ltd
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@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/5ZIK4ESPNPX2YL4MNGGMNIFE56YIHCAP/
Code of Conduct: http://python.org/psf/codeofconduct/