[Zope] Storing an object in RAM during Zope's up-time

Michel Pelletier michel@digicool.com
Sat, 08 Apr 2000 15:35:37 -0700


Hung Jung Lu wrote:
> 
> 
> You might ask thread safety, and I would say this is
> a big issue. I haven't looked into Python threads lately,
> but I seem to recall that Python is borrowing Java's
> thread model... which almost makes me want to scream.

I don't think this is true, there are actually two thread extensions for
python, one is low-level and one is high-level.  It might be true that
the high-level on is Java-esque, but the low-level one is very
straightforward.

> Jave doesn't allow exclusive time-slice (or a global lock)
> due to security concerns. But this makes thread programming
> really painful. Hopefully Python doesn't repeat the same
> mistake of Java. We really really need exclusive time-slice
> at least for some of the basic Python operations. Funny thing
> is that thread programming has been around town since a long
> time ago, but I don't understand why they let all these
> grandious novices dictate and screw up everything. :)

I believe almost all of the basic type operations in Python are thread
safe, such as list.append(), if this is what you mean by 'exclusive
time-slice', I'm not very up on the lingo.  In terms of thread safety
for Python code, you can pretty much get away with your existing code as
long as:

1) you don't change mutable global variables (without locking)

2) you don't change mutable default arguments to methods (also, without
locking).

Other than that I've never had to think about thread-safety is any of my
code.

-Michel