Learning Python, Python web Application stay active between requests
<p>I am a PHP programmer learning Python, when ever I get a chance.</p>

<p>I read that Python web Application stay active between requests. 
Meaning that data stays in memory and is available between requests, right?</p>

<p>I am wondering how that works.</p>

<p>In php we place a cookie with a unique token, and save data in sessions.
Sessions are arrays, saved on disk or database.
Between requests the session functions, restore the correct session array based on the cookie with the unique token. That means each browser gets it's own unique session, and the session has a preset expiration time. If the user is inactive and the expiration get's triggered then the session gets purged. A new session has to be created when the user comes back.</p>

<p>My understanding is Python doesn't need this, because the application stays active between requests. </p>

<p>Doesn't each request get a unique thread in Python?</p>

<p>How does it distinguish between requests, who the requester is?</p>

<p>Is there a handling method to separate vars between users and application?</p>

<p>Lets say I have a dict saved, is this dict globally available between all requests from any browser, or only to that one browser.   </p>

<p>When and how does the memory get cleared. If everything stays in the memory. What if the app is running for a couple years without a restart. There must be some kind of expiration setting or memory handling?</p>

<p>One commenter says it depends on the web app. So I am using Bottle.py to learn.</p>
