Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #30560
| References | <15f76508-437a-4d18-ac9b-16174ef172e8@googlegroups.com> <mailman.1672.1349011558.27098.python-list@python.org> <roy-A05EF0.10233530092012@news.panix.com> <mailman.1675.1349015755.27098.python-list@python.org> <roy-0C9D23.11011030092012@news.panix.com> |
|---|---|
| Date | 2012-10-01 01:37 +1000 |
| Subject | Re: Can somebody give me an advice about what to learn? |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1677.1349019431.27098.python-list@python.org> (permalink) |
On Mon, Oct 1, 2012 at 1:01 AM, Roy Smith <roy@panix.com> wrote:
> Well, more strictly, what you need is to keep your state somewhere else.
> Doesn't have to be on disk. Could be in memory, if that memory belongs
> to another process (memcache, redis, or any of a number of in-memory
> databases).
Sure. I'll generalize my statement to "Has to be external to the
process". That generally precludes the direct use of complex objects,
requiring some form of serialization or dump format - you can't, for
instance, retain a "socket connection object" across that sort of
reload.
> Why does it have to be a single process? I could imagine some front-end
> process which accepts connections and hands them off to worker
> processes. When you install new code, you could do it in a different
> directory tree, and then signal the front end that new code exists. The
> front end could then {chdir, munge sys.path, whatever} to the root of
> the new tree and keep going. Existing connections stay up with the old
> code, new connections get the new code.
That's also a good model, for situations that can use it. My situation
is a MUD-like system where different clients can affect one another,
so the most logical way to do it is a single process. For instance, we
have a Dungeons and Dragons battle grid that uses a web browser as its
display engine; you go to a particular URL, key in your login details,
and it sends AJAX long polls to the server. Whenever one client moves
a token on the grid, every other client gets notified. I could, of
course, do this across processes, but I'd end up needing a hefty IPC
system; this way, all I need is a lightweight event semaphore that the
threads wait on, and they look at the process's internal structures
(thread-safe, they need only read at that point). I could have done it
in other ways, of course, but this is nice and straightforward.
But this is getting rather off-topic :) For the bulk of usage
patterns, Python's fine. Most languages don't let you reload code on
the fly, and most applications are never going to be bothered by this
miniscule feature lack!
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Can somebody give me an advice about what to learn? tcgo <tomeuari@gmail.com> - 2012-09-30 05:58 -0700
Re: Can somebody give me an advice about what to learn? Chris Angelico <rosuav@gmail.com> - 2012-09-30 23:25 +1000
Re: Can somebody give me an advice about what to learn? Roy Smith <roy@panix.com> - 2012-09-30 10:23 -0400
Re: Can somebody give me an advice about what to learn? Chris Angelico <rosuav@gmail.com> - 2012-10-01 00:35 +1000
Re: Can somebody give me an advice about what to learn? Roy Smith <roy@panix.com> - 2012-09-30 11:01 -0400
Re: Can somebody give me an advice about what to learn? Chris Angelico <rosuav@gmail.com> - 2012-10-01 01:37 +1000
Re: Can somebody give me an advice about what to learn? Roy Smith <roy@panix.com> - 2012-09-30 18:14 -0400
Re: Can somebody give me an advice about what to learn? Chris Angelico <rosuav@gmail.com> - 2012-10-01 09:11 +1000
Re: Can somebody give me an advice about what to learn? Hans Mulder <hansmu@xs4all.nl> - 2012-10-03 19:55 +0200
Re: Can somebody give me an advice about what to learn? Chris Angelico <rosuav@gmail.com> - 2012-10-01 00:37 +1000
Re: Can somebody give me an advice about what to learn? Tim Chase <python.list@tim.thechases.com> - 2012-09-30 08:45 -0500
Re: Can somebody give me an advice about what to learn? rusi <rustompmody@gmail.com> - 2012-09-30 08:18 -0700
Re: Can somebody give me an advice about what to learn? Roy Smith <roy@panix.com> - 2012-09-30 18:17 -0400
Re: Can somebody give me an advice about what to learn? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-30 23:59 +0000
Re: Can somebody give me an advice about what to learn? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-30 16:47 +0100
Re: Can somebody give me an advice about what to learn? Wolfgang Keller <feliphil@gmx.net> - 2012-10-03 20:31 +0200
Re: Can somebody give me an advice about what to learn? Chris Rebert <clp2@rebertia.com> - 2012-10-03 21:47 -0700
Re: Can somebody give me an advice about what to learn? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-04 06:34 +0000
Re: Can somebody give me an advice about what to learn? Wolfgang Keller <feliphil@gmx.net> - 2012-10-04 19:45 +0200
csiph-web