I think that Type[C,D] would mean Union[Type[C], Type[D]], but I'm not sure
... I should probably talk to a typing expert about this.
(Sorry for thinking out loud; but if we decide that Type[C,D] doesn't make
sense, we need to prohibit it)

I suppose I'm asking: do we allow new_user(Type[BasicUser, ProUser])?

Here's a trivial example that off the top of my head makes sense:

BasicOrProUser = TypeVar('BasicOrProUser', BasicUser, ProUser)
def new_user(name: str, user_factory: Type[BasicOrProuser]) ->
BasicOrProUser:
    return user_factory(name)

Or must the Type[...] item have been defined with a TypeVar(...,
bound=...), in which case multiple types aren't allowed with Type[...]?


On 14 May 2016 at 11:30, Guido van Rossum <gvanros...@gmail.com> wrote:

> What would Type[C, D] mean?
>
> --Guido (mobile)
> On May 14, 2016 11:21 AM, "Peter Ludemann via Python-Dev" <
> python-dev@python.org> wrote:
>
>> Is Type[C,D] allowed? Or should multiple types be restricted to TypeVar?
>>
>> _______________________________________________
>> Python-Dev mailing list
>> Python-Dev@python.org
>> https://mail.python.org/mailman/listinfo/python-dev
>> Unsubscribe:
>> https://mail.python.org/mailman/options/python-dev/guido%40python.org
>>
>>
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to