Ted Leung on the air
Ted Leung on the air: Open Source, Java, Python, and ...
Wed, 05 Nov 2003
Why type annotation is important for Python
James Robertson didn't like my idea for a Python type annotator as a MS thesis level Python project. I happen to agree with James' opinion on the value of testing vis a vis discovering type errors. The reason that I think a type annotator is important is that it can be provided as a crutch for those who are used to static typing and are just too afraid to let it go. Once you have a type annotator, it becomes a matter of time before you can demonstrate that programs that pass your test suites also pass the type annotator. Once that becomes routine, you can stop running the annotator. This one is about doing something to get the curly brace people to jump the fence and come on over.

If an annotator makes it easier to geneate IDL or WSDL or whatever, then that's a nice side effect as well.

[23:24] | [computers/programming/python] | # | TB | F | G | 5 Comments | Other blogs commenting on this post
Thanks for continuing this dialog.  I can't find the source for GvR's quote in this weeks Python-URL but your thoughts on this would be appreciated.

"...at some point in the future Python will grow (optional) type declarations for all sorts of things (arguments, local variables,instanc e variables)."
  --Guido van Rossum

(p.s. Congrats on OSAF! :-))
Posted by DeanG at Thu Nov 6 08:17:31 2003



PyPy is to have type-inference and an internal annotation system to go along with it. It would be cool if the system was able to give interactive feedback and generate reports based on that information.
Posted by Robert Sayre at Thu Nov 6 15:35:28 2003

I don't really buy the crutch argument. Optional static typing, be it inferred through runtime analysis, static analysis or explicitly; it could enable so many other advances for python that the new convert argument would be at the bottom of my list.

The possibilities include:
* Automatic code generation to interact with statically typed languages. This could happen either during a compilation phase or during a JIT. This would be like building in
ctypes and Pyrex directly into the language. I would be extra happy if the type inference was done OCaml style.
* Automatic code generation for performance, see below
* Hints to PyPy
* Making it easier to implement run time type enforcement rather than coding it by hand.
* Could enable the multilanguage VM where Python, Java and OCaml could execute side by side, ala Jython

I personally would frown upon using static typing in interface definitions except in some narrow circumstances such as interfacing native code or performance critical libraries such a Numeric. Python is good because it is generic.

Typing could be bad for the following reasons:
* Could force developers to create an abundance of unneeded wrapper classes
* We could see types start to leak out from interfaces and infect the rest of the calling code.
* Needs to be thoroughly thought out, the implications of a poor design could make Python a lot less fun. Maybe it needs a way to turn it off and revert all of the typed code back into plain python ?
Posted by Sean Jensen-Grey at Sat Nov 15 00:33:05 2003

You can subscribe to an RSS feed of the comments for this blog: RSS Feed for comments

Add a comment here:

You can use some HTML tags in the comment text:
To insert a URI, just type it -- no need to write an anchor tag.
Allowable html tags are: <a href>, <em>, <i>, <b>, <blockquote>, <br/>, <p>, <code>, <pre>, <cite>, <sub> and <sup>.

You can also use some Wiki style:
URI => [uri title]
<em> => _emphasized text_
<b> => *bold text*
Ordered list => consecutive lines starting spaces and an asterisk

Name:


E-mail:


URL:


Comment:


Remember my info?


twl JPG

About

Ted Leung FOAF Explorer

I work at the Open Source Applications Foundation (OSAF).
The opinions expressed here are entirely my own, not those of my employer.

Creative Commons License
This work is licensed under a Creative Commons License.

Now available!
Professional XML Development with Apache Tools : Xerces, Xalan, FOP, Cocoon, Axis, Xindice
Technorati Profile
PGP Key Fingerprint
My del.icio.us Bookmarks
My Flickr Photos


Syndicate
RSS 2.0 xml GIF
Comments (RSS 2.0) xml GIF
Atom 0.3 feed
Feedburner'ed RSS feed

< November 2003 >
SuMoTuWeThFrSa
       1
2 3 4 5 6 7 8
9101112131415
16171819202122
23242526272829
30      

Archives
2006
2005
2004
2003

Articles
Macintosh Tips and Tricks

Search
Lucene
Blogs nearby
geourl PNG

Categories
/ (1567)
  books/ (33)
  computers/ (62)
    hardware/ (15)
    internet/ (58)
      mail/ (11)
      microcontent/ (58)
      weblogs/ (174)
        pyblosxom/ (36)
      www/ (25)
    open_source/ (145)
      asf/ (53)
      osaf/ (32)
        chandler/ (35)
        cosmo/ (1)
    operating_systems/ (16)
      linux/ (9)
        debian/ (15)
        ubuntu/ (2)
      macosx/ (101)
        tips/ (25)
      windows_xp/ (4)
    programming/ (156)
      clr/ (1)
      dotnet/ (13)
      java/ (71)
        eclipse/ (22)
      lisp/ (34)
      python/ (86)
      smalltalk/ (4)
      xml/ (18)
    research/ (1)
    security/ (4)
    wireless/ (1)
  culture/ (10)
    film/ (8)
    music/ (6)
  education/ (13)
  family/ (17)
  gadgets/ (24)
  misc/ (47)
  people/ (18)
  photography/ (25)
    pictures/ (12)
  places/ (3)
    us/ (0)
      wa/ (2)
        bainbridge_island/ (17)
        seattle/ (13)
  skating/ (6)
  society/ (20)



[Valid RSS]

del.icio.us linkblog

www.flickr.com

Blogroll

java.blogs
Listed on BlogShares

Locations of visitors to this page
Where are visitors to this page?


pyblosxom GIF