On Fri, Jul 31, 2020 at 3:48 PM Rebecca Chen via Typing-sig <typing-sig@python.org> wrote:


On Fri, Jul 31, 2020 at 12:09 PM Mark Mendoza <mendoza.mark.a@gmail.com> wrote:
Hi Rebecca & Guido,

> Hm, why a submodule at all?

I opted for a submodule in anticipation of future operators such as `Map`, which I thought might be confusing if were just at the top-level of `typing`.  I don't have strong opinions on this, and am happy to go with either `typing.operators.Concatenate` or just `typing.Concatenate`.
My concern was mainly that a long submodule name would be tedious to use when importing, etc., so either typing.operators.Concatenate or typing.Concatenate seems reasonable to me. Personally, I would slightly lean towards having the submodule if there are likely to be future operators.

I want to push back here some more. The typing operators are only useful with the types, and the types are not in a sub-namespace. Even if there were a future operator `Map`, it doesn't actually clash with the `Mapping` ABC, and most people are just going to write `from typing.operators import *`. And for those people who prefer to do something like `import typing as t` and then write `t.Any`, `t.TypeVar` etc., `t.operators.Concatenate` would still be rather unwieldy. (I observe that the examples in the PEP use `from typing.operators import Concatenate`. :-)

I added the requested example and fixed the two typos in this PR: https://github.com/python/peps/pull/1545

I'll hold off on that until we've agreed on where `Concatenate` will live.

PS. Personally I would probably end up writing `from typing import Concatenate as Cat`, but that's just me being an old UNIX hack. :-)

--
--Guido van Rossum (python.org/~guido)