optional types

Kiuhnm gandalf23 at mail.com
Wed Oct 29 13:18:35 EDT 2014


On Wednesday, October 29, 2014 5:57:13 PM UTC+1, Peter Otten wrote:
> Kiuhnm wrote:
> 
> > I must say that the lack of static types in Python is a pain in the neck
> > especially when I'm exploring new libraries. Recently, I learned a new
> > language called Dart which have optional typing and I had a lot of fun
> > with it. Basically, you use type annotations as documentation and to give
> > useful information to the IDE or editor. That makes the IDE look *very*
> > smart! I'm using PyCharm and more often than not I want to see the list of
> > methods and attributes of an object, but the editor won't show them to me
> > because it doesn't know the dynamic type of the variable whose value was
> > just returned by a function. That's irritating! Am I the only one who'd
> > like to see optional types introduced in Python?
> 
> Personally I am skeptical, but there is an effort underway:
> 
> http://www.mypy-lang.org/
> https://mail.python.org/pipermail/python-ideas/2014-August/028742.html
> 
> Nothing that your search engine of choice could not have found you...

In fact, I did find it, but that didn't stop me from asking :)

You can find something similar for almost any dynamic language out there.
If it isn't an official feature of the language, it's useless, IMHO.

It seems that PyCharm supports some kind of type annotations:
http://www.jetbrains.com/pycharm/webhelp/using-docstrings-to-specify-types.html
Unfortunately, again, if almost no one uses them, they're not very useful.



More information about the Python-list mailing list