Strong typing implementation for Python

John Michael Lafayette johnmichaelreedfas at gmail.com
Mon Oct 12 04:25:26 EDT 2015


No. Python now has static type checking and IDE auto-complete support. All
you have to do is put the type name in the function declaration.
On Oct 11, 2015 3:45 PM, "Matt Wheeler" <m at funkyhat.org> wrote:

> On 9 October 2015 at 17:26, John Michael Lafayette
> <johnmichaelreedfas at gmail.com> wrote:
> > I would like Python to have a strong typing feature that can co-exist
> with
> > the current dynamic typing system. Currently Python is like this:
> >
> >     var animal = Factory.make("dog")  # okay.
> >     var dog = Factory.make("dog")       # okay.
> >     var cat = Factory.make("dog")        # are you sure?
> >
> > I would like Python to also be able to also do this:
> >
> >     Animal a = Factory.make("dog")    # okay. Dog is Animal.
> >     Dog d = Factory.make("dog")         # okay. Dog is Dog.
> >     Cat c = Factory.make("cat")           # Runtime error. Dog is not
> Cat.
>
> Though it's intended for performance optimisation rather than simply
> static typing for static typing's sake, you could probably use Cython
> to achieve what you want...
>
> ...but then you might start to see the benefits of dynamic typing :)
>
>
> --
> Matt Wheeler
> http://funkyh.at
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20151012/b8093296/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Static_Typechecked_Python.png
Type: image/png
Size: 15240 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20151012/b8093296/attachment.png>


More information about the Python-list mailing list