> A decorator is a modifier to a subsequent binding, and it modifies the > reference and not the referent. So how is it anythng but declarative?
I learned the hard way that it still is simply interpreted - its a pretty straight forward syntactic sugaring, as this shows: foo = classmethod(foo) becomes: @classmethod Now @classmethod has to return a callable that gets passed foo, and the result is assigned to foo - not more, not less, so it becomes equivalent to the older type of creating a class method. Is this a declaration? I'd personally say and think "practically, yes", as I also view class Bar: .... as a declaration. But obviously some people like Alex Martelli have different views on this (and are right), because you can do this in python: if condition: class Foo: def bar(self): pass else: class Foo: def schnarz(self): pass So that makes class statements not as declarative as they are in languages like java. So to sum it up (for me at least): things like metaclasses, decorators and so on make me write code more declarative - if they are a declaration in the strict sense, I don't bother. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list