Decorators and static typing.
stephen.thorne at gmail.com
Wed Jan 5 18:52:15 EST 2005
On Wed, 05 Jan 2005 15:30:27 -0800, whisper at oz.net <whisper at oz.net> wrote:
> Well, the decorator war is over (Python lost IMO!) and now we've got the
> static typing war to fight!
> Both of these seem like syntax sugar to avoid writing good code! One has
> already introduced ugly coding and the 2nd is likely to do the same!
IMHO, the syntax is irrelevent. The goal of making it a core language
feature is to remove the necessity of people writing their own type
checkers and interface implementations.
Essentially at the moment we have a situation with zope.interfaces
that is causing many python projects that are completely unrelated to
Zope (for instance, twisted) to depend on zope.interfaces, because its
the most standard way of doing interfaces in Python.
No one is going to like the syntax, and if anyone actually does,
they're not going to speak up. Guido knows this. Thats why he's the
BDFL, he can just dictate what the syntax SHALL be, and avoid 150 post
threads over if '@' is better than 'dec' for decorators.
Sure, we can implement type checking without language changes, but in
doing so, we kill the entire point. Something standard is desired. Why
don't we make it a language feature so that we don't have to waste
even more lines of code and brain-cycles with obscure things like:
assert type(n) in (int, float) or subscribesToDuckType("number")
using handwritten APIs that differ between every project.
More information about the Python-list