Design question - Sharing of single object by multiple processes

Mike D 42flicks at gmail.com
Thu Jan 31 06:07:40 CET 2008


Hello, I've just picked up the Python language and am really enjoying it.

I've just signed up to this mailing list and I'm looking forward to taking
part in some discussions.

My first post is a question I've been pondering for the last couple of days:

For relatively static data (such as a list), is it possible to load a single
instance and have many python processes access it?

I want to have an object in memory. This object will be loaded on
application start up and will contain a list of objects. These will be
obtained from (most likely) the file system.

My reasoning is: I want to prevent a file system or database fetch each time
as it seems unnecessary.

Is this possible? In Java I'm pretty sure this could implemented with an
object factory and static methods. My understanding is that python invokes a
separate process for each request however.

If possible, what would be a good way of providing a new structure as it is
updated.

If anyone could give me some advice or point me in the correct direction I'd
really appreciate it.

Thanks in advance,

Mike.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080131/c5ad763c/attachment.html>


More information about the Python-list mailing list