[Python-ideas] Optional static typing -- the crossroads
Łukasz Langa
lukasz at langa.pl
Sun Aug 17 11:49:59 CEST 2014
On Aug 17, 2014, at 2:44 AM, Łukasz Langa <lukasz at langa.pl> wrote:
> On Aug 17, 2014, at 2:33 AM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
>
>> Stefan Behnel wrote:
>>> However, it does not support protocols, so it still needs
>>> something that allows us to say Iterable(int) in some way.
>>
>> Just had a thought -- does mypy provide a way to express
>> a type that supports more than one protocol? E.g. can you
>> say that something must be both Iterable and Hashable?
>
> That would be union types. Current syntax:
> Union[Iterable[int], Hashable]
>
> Proposed more concise syntax:
> Iterable[int] | Hashable
Ah, scratch that. What Greg asked about would be
Iterable[int] & Hashable
;-)
Don't know if this is supported but makes sense.
--
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/20140817/9fa7e673/attachment.html>
More information about the Python-ideas
mailing list