Next step after pychecker
Francis Girard
francis.girard at free.fr
Wed Feb 2 04:53:55 EST 2005
To complete Philippe's answer :
As Bird and Wadler continue :
"The major consequence of the discipline imposed by strong-typing is that any
expression which cannot be assigned a "sensible" type is regarded as not
being well-formed and is rejected by the computer before evaluation. Such
expression have _no_ value: they are simply regarded as illegal."
But Skip, I am sure that you can easily find an example by yourself. For
example, replace "+" by a function that does different things depending on
its argument type.
Francis Girard
Le mercredi 2 Février 2005 10:27, Philippe Fremy a écrit :
> 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