Lisp mentality vs. Python mentality

Paul Rubin http
Sun Apr 26 23:38:16 CEST 2009


Carl Banks <pavlovevidence at gmail.com> writes:
> Say you are running a thread and you want the power to be able to kill
> it at any time.  The thread is either communicating with the rest of
> the program periodically, or it isn't.  If it is, then there are ample
> opportunities to tell the thread to terminate itself.  If it isn't,
> then you might as well use a separate process which you can kill.

That's not so satisfying.  If you use a separate process, it can't
share Python objects with the main process, isn't under the same
memory management, etc.  With the standard modules that comes with
Python, you can't share memory at all (except with mmap, which gives
no synchronization mechanisms).  You can't pass open sockets from one
process to another with the standard library, making it harder to
implement typical multi-threaded servers.  You do get better
scalability, but at the expense of having to serialize all IPC data
and use heavyweight communication mechanisms.  Threads exist because
they are useful.



More information about the Python-list mailing list