"Gert Cuykens" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | would it not be nice if you could assign decorators to attributes too ? | for example | | class C: | @staticattribute | data='hello' | | or | | class C: | @privateattribute | data='hello'
No. @g def f(): pass is equivalent to and an abbreviation fo def f(): pass f = g(f) The rationale for the abbreviation is 1. let the human reader know immediately that the function will get special treatment 2. (related) put the notation about the function at the top with other header stuff 3. avoid retyping really_long_function_names three times (and there are uses of Python where long, multicomponent names are sensible and useful). But nothing is gained and something is lost by writing clear code like data = staticattribute('hello') # or privateattribute('hello') in two lines. Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list