> i find it strange that var3 is kept between requests even though a new
> instance of tClass is created for each request. if i change line 19
> from
> t = tClass('tClass')
> to
> t = tClass('tClass' [])
> the output is exactly what i expect it to beNote that you have set the default value for var2 be [], that is, an instance of list created when the module was imported. So every new instance of that class will get the _same_ list as their default value, so appending to the list is always appending to the same list. This is a typical mistake that I have made too. If you want that the default value for a parameter is always an empty list (or instance of any other object too), set the default value be None and in __init__ check if it is None and then set it to be []. Since that [] is inside the method code, it is executed every time a new instance is created. The original [] was in global scope, so it was only executed once, when mod_wsgi process originally loaded your script, so only one list instance was created and shared with all run times. I hope this clarifies the weird looking behavior.
-- You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
