[Python-ideas] [Wild Idea] Static Ducks

Masklinn masklinn at masklinn.net
Sun Sep 20 00:40:35 CEST 2009

On 20 Sep 2009, at 00:24 , Dj Gilcrease wrote:
On Sat, Sep 19, 2009 at 4:44 AM, Masklinn <masklinn at masklinn.net> wrote:
>> As far as I'm concerned, it's a terrible idea. Because it doesn't  
>> fit well
>> within Python as a dynamically typed language, because the syntax  
>> is ugly,
>> because Java's C-inherited type prefixes look terrible and are  
>> extremely
>> verbose, because Java's type system is pretty bad and finally  
>> because the
>> proposal doesn't handle "generic" types, making it completely  
>> useless.
> explain "generic" types
parameterized types: a list of strings (List[String]), a tuple of  
(int, string) (Tuple[Int, String]), a dict of {Foo:Bar} (Dict[Foo,  
Bar]) etc…

Not having parameterized types means every time you take values out of  
e.g. a collection you'll have to either use an untyped/"dynamic"  
variable or cast it to the "right" type (nb: and Python doesn't have  
casts), and you lose the static guarantee of homogeneity for e.g.  
lists (with non-generic lists, all your lists are lists of `id` the  
"dynamic" type).

More information about the Python-ideas mailing list