mix statically typed with dynamically typed

Duncan Booth duncan.booth at invalid.invalid
Thu Jan 28 22:53:45 CET 2010

"Alf P. Steinbach" <alfps at start.no> wrote:

> I'm not sure I like your idea of introducing static typing to increase
> speed, but it could be done without introducing new syntax simply by
> defining a special meaning to such annotation expressions that are
> 'type' invocations, say, then like 
>    def speed( dist: type( float ), time: type( float ) ) -> type(
>    float ) 

That would be particularly useless:

>>> type(float) is type

So your declaration is identical to:

  def speed(dist: type, time: type) -> type:

Much better just to stick to something like:

  def speed( dist: float, time: float ) -> float:

where at least you can tell from the annotations what types were actually 

More information about the Python-list mailing list