No. That was an alternative solution proposed by some people to solve the problem. But I don’t believe it’s a good solution for reasons already mentioned above.
Sorry for being thick – but what is “the problem” in this case?
One problem is explicitly that passing an str
into a function expecting Iterable[str]` usually does not mean what the user expects, and folks would like the type checker to catch that.
This thread is not specifically about that problem, but about “Type intersection and negation in type annotations” – but that problem is one motivation for type negation – and the idea seems like it would solve this one problem just fine. but I think you have another problem, or set of problems, in mind.
Very cool. At a glance, it looks like a TypeGuard could be used to catch the Iterable[str]
case too More awkward that the various other proposals on the table, but it looks like it could be done. But again, I only looked at it quickly.