A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2015-May/140039.html below:

[Python-Dev] PEP 484 wishes

[Python-Dev] PEP 484 wishes [Python-Dev] PEP 484 wishesIvan Levkivskyi levkivskyi at gmail.com
Mon May 18 13:59:11 CEST 2015
> >  Looking at PEP 484, I came up with two use cases that I felt were not
> > catered for:
> >
> >    1. Specifying that a parameter should be a subclass of another
> >    (example: Type[dict] would match dict or OrderedDict; plain "Type"
would
> >    equal "type" from builtins)
> >
> >
> I don't understand. What is "Type"? Can you work this out in a full
> example? This code is already okay:
>
> def foo(a: dict):
>     ...
>
> foo(OrderedDict())

I think Alex means this: https://github.com/ambv/typehinting/issues/107
This could be really useful, for example:

def fancy_instantiate(cls: Type[T]) -> T:
    ...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150518/1d508d26/attachment.html>
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4