mix statically typed with dynamically typed
Alf P. Steinbach
alfps at start.no
Thu Jan 28 17:07:24 EST 2010
* Duncan Booth:
> "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
> True
>
> So your declaration is identical to:
>
> def speed(dist: type, time: type) -> type:
That's the point.
> 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
> used.
No, you do not want to redefine the meaning of existing (actually used) constructs.
That would be particularly useless, to use your own words. :-)
Cheers & hth.,
- Alf
More information about the Python-list
mailing list