Understanding Python from a PHP coder's perspective

Chris Angelico rosuav at gmail.com
Mon Dec 7 22:26:57 EST 2015


On Tue, Dec 8, 2015 at 12:00 PM,  <villascape at gmail.com> wrote:
> Ah, I was confused that process state somehow allowed Python to support per-connection state without using sessions (which lead me to ask about websockets).  I guess Python could do it without storing the session ID in a file or database and instead in process state (i.e. application memory, right?), but the effect seems basically the same. Without being per-connection, what is the value of process state?
>

Caches and stuff. For example, you might establish a database
connection, and then hang onto it for all queries; or maybe you load
up a bunch of user objects and keep them in memory for when you need
them again. Anything that you store in a global (module-level)
variable will hang around.

ChrisA



More information about the Python-list mailing list