> Your example code isn't declaring message as a global variable, and it > won't be cached. It's really difficult to accidentally use the global > statement.
I exactly thought the same thing as you until I noticed messages from one Page instance showing up in another across requests! Here it says why: http://docs.python.org/ref/class.html In Python all variables declared in a class are IMPLICITLY class- variables and thus static/shared! You do not need the global statement this way. People coming from Java/PHP/C++ might expect that these variables are instance variables. Its also convenient to use these as defauts for instance variables. Programmer's note: Variables defined in the class definition are class variables; they are shared by all instances. To define instance variables, they must be given a value in the __init__() method or in another method. Paste this into your Python console to see how to create a static variable without "global" statement. ##### EXAMPLE 1: ##### class Page(): message = 'hello' # could be an error message to be inserted into any next page that will be creaed Page.message += " world" # Notice: Page, not p p = Page() print p.message # next request retrieves the error message of the previous request q = Page() print q.message ###### EXAMPLE 2: ###### class Page(): messages = ['hello'] def __init__(self): self.messages.append(" world") # APPEND TO STATIC CONTEXT # could be an error message to be inserted into any next page that will be creaed p = Page() print p.messages # next request retrieves the error message of the previous request q = Page() print q.messages --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---