[Python-ideas] [Wild Idea] Static Ducks
masklinn at masklinn.net
Sat Sep 19 12:44:56 CEST 2009
On 19 Sep 2009, at 11:16 , Steven D'Aprano wrote:
> What sort of type checking is done?
> Pascal-style declarative type checking, or Haskell-style type
Can't answer the rest, but from his examples and if $type and
$returnType are indeed type specifications placeholders (which would
be the ducks), it would be a java-style static type system (…).
And it would probably be run at "compile" time given the name, doing
the checking at runtime wouldn't be very static.
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
I also haven't seen any example of typing an instance attribute, the
only example involving classes creates a class attribute:
$type variable = value
$returnType def method(self, $type variable):
More information about the Python-ideas