Next step after pychecker

Philippe Fremy phil at freehackers.org
Wed Feb 2 04:27:43 EST 2005


Skip Montanaro wrote:
>     Francis> "Every well-formed expression of the language can be assigned a
>     Francis> type that can be deduced from the constituents of the
>     Francis> expression alone." Bird and Wadler, Introduction to Functional
>     Francis> Programming, 1988
> 
>     Francis> This is certainly not the case for Python since one and the
>     Francis> same variable can have different types depending upon the
>     Francis> execution context. Example :
> 
>     Francis> 1- if a is None:
>     Francis> 2-   b = 1
>     Francis> 3- else:
>     Francis> 4-   b = "Phew"
>     Francis> 5- b = b + 1
> 
>     Francis> One cannot statically determine the type of b by examining the
>     Francis> line 5- alone.
> 
> Do you have an example using a correct code fragment?  It makes no sense to
> infer types in code that would clearly raise runtime errors:

On the contrary, the point of type inference is to detect such errors. 
If the program was always well-formed, there would be no point in 
developing a type inference tool.

	Philippe



More information about the Python-list mailing list