Apologies to Piet and Diez for the lack of clarity in my previous post (and the broken code).
In essence we use class variables as follows: class Part (object): totalgia = 0 def __init__(self, gia): self.gia = gia # gross internal area self.giaratio = 0 Part.totalgia += self.gia def addavgbm(self): self.giaratio = float(self.gia)/float(Part.totalgia) def __repr__(self): return "gia: %0.1f giaratio: %0.2f" % (self.gia, self.giaratio) if __name__ == '__main__': p1 = Part(20) p2 = Part(30) for p in p1, p2: p.addavgbm() print p totalgia keeps incrementing when this code is used under mod_python. We most certainly are in 'murky waters of accidental concurrent access'. A life vest would be gratefully received. Kind regards Rory On 22/02/07, Rory Campbell-Lange ([EMAIL PROTECTED]) wrote: > We have a set of classes using static methods to retain reference > variables between operations. The problem is that the static variables > are not reset between operations when used through mod_python. > > Although it is possible to reset the class variables between invocations > of the system, this has the potential of 'wiping out' these variables > when another user is using the system. > > Is there a way of getting the equivalent of 'local class variables'? In > other words, a way of making 'print a' and 'print b' below provide the > same output? On 22/02/07, Piet van Oostrum ([EMAIL PROTECTED]) wrote: > >>>>> Rory Campbell-Lange <[EMAIL PROTECTED]> (RC) wrote: > There are several errors in your python code: quite a number of comma's > have to be replaced by semicolons (or newlines), and there is a spurious > comma. On 22/02/07, Diez B. Roggisch ([EMAIL PROTECTED]) wrote: > Rory Campbell-Lange wrote: > It's very unclear what you mean here, and I'm additionally under the > impression that you are deep in the murky waters of accidential > concurrent access errors here. -- Rory Campbell-Lange <[EMAIL PROTECTED]> <www.campbell-lange.net> -- http://mail.python.org/mailman/listinfo/python-list