[Tutor] Declaration order of classes... why it is important?

Lie Ryan lie.1296 at gmail.com
Thu Aug 27 09:21:14 CEST 2009


Mac Ryan wrote:
<snip>
> Second thing: the example that Dave gave me and that I left quoted above
> makes use of decorators, but this is something that I still do not
> understand. I believe I got a grasp of the concept of metaclasses, to
> which the concept of decorator seems to be related, but the official
> documentation is a a bit obscure for me.

Think in black box. Consider the decorator syntax for staticmethod and 
classmethod as a special syntax to create functions that doesn't require 
the instance and function that requires class object. Forget about the 
fact that it uses metaclasses stuff to do its bidding, just know that 
decorator is simply a syntax sugar for function call and staticmethod() 
and classmethod() as a magical function that "eats self" and "turns self 
to class". Don't bother about the implementation details.



More information about the Tutor mailing list