On Sep 21, 1:30 am, alex23 wrote:
> Bruno Desthuilliers
> wrote:
>
> > alex23 a écrit :
> > > Python only actually executes a module the first time it's imported,
>
> > Beware of multithreading and modules imported under different names...
> > There can be issues with both in some web frameowrks.
On Sep 20, 7:39 am, Bruno Desthuilliers wrote:
> Niklasro a écrit :
>
> > Good to learn what I'm doing :-) since important being able to explain
> > choices taken farther than "doing it because it works".
> > I understand the concept of modules may not correspond to java
> > programming where I co
Bruno Desthuilliers
wrote:
> alex23 a écrit :
> > Python only actually executes a module the first time it's imported,
>
> Beware of multithreading and modules imported under different names...
> There can be issues with both in some web frameowrks.
Good points, Bruno, thank you.
Niklasro, a goo
Niklasro a écrit :
Good to learn what I'm doing :-) since important being able to explain
choices taken farther than "doing it because it works".
I understand the concept of modules may not correspond to java
programming where I come from.
Coming from Java - and specially if you only have exper
alex23 a écrit :
Python only actually executes a module the first time it's imported,
Beware of multithreading and modules imported under different names...
There can be issues with both in some web frameowrks.
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 19, 8:12 am, Thomas Jollans wrote:
> On 2010-09-19 09:22, Niklasro wrote:> util.py:
> > url = os.environ.get("HTTP_HOST", os.environ["SERVER_NAME"]) #declared
> > as class variable(?)
>
> There is no class here, so this is no class variable, and you're not
> inheriting anything. You're simp
On 2010-09-19 09:22, Niklasro wrote:
> util.py:
> url = os.environ.get("HTTP_HOST", os.environ["SERVER_NAME"]) #declared
> as class variable(?)
>
There is no class here, so this is no class variable, and you're not
inheriting anything. You're simply using a module.
> And viola just test if util
It works but I don't know whether it's formally inheritance or class
variable.
Before code was
url = os.environ['HTTP_HOST'] if os.environ.get('HTTP_HOST') else
os.environ['SERVER_NAME']
if url.find('niklas') > 0:
and now the change saves me from repeating myself!
util.py:
url = os.envir
On Sep 19, 2:31 am, alex23 wrote:
> Niklasro wrote:
> > I got 2 files main.py and i18n both with
> > webapp request handlers which I would like access the variable.
>
> I'd probably use a module for this. Create a third file, called
> something like shared.py, containing the line that bruno gave
On Sep 18, 11:15 pm, Jorgen Grahn wrote:
> On Sat, 2010-09-18, Niklasro wrote:
> > Hi
> > How can I make the visibility of a variable across many methods or
> > files? To avoid repeating the same line eg url =
> > os.environ['HTTP_HOST'] if os.environ.get('HTTP_HOST') else
> > os.environ['SERV
Niklasro wrote:
> I got 2 files main.py and i18n both with
> webapp request handlers which I would like access the variable.
I'd probably use a module for this. Create a third file, called
something like shared.py, containing the line that bruno gave above:
url = os.environ.get("HTTP_HOST", os.e
On Sep 18, 4:15 pm, Jorgen Grahn wrote:
> On Sat, 2010-09-18, Niklasro wrote:
> > Hi
> > How can I make the visibility of a variable across many methods or
> > files? To avoid repeating the same line eg url =
> > os.environ['HTTP_HOST'] if os.environ.get('HTTP_HOST') else
> > os.environ['SERVE
On Sep 18, 4:13 pm, "bruno.desthuilli...@gmail.com"
wrote:
> On 18 sep, 17:25, Niklasro wrote:
>
> > Hi
> > How can I make the visibility of a variable across many methods or
> > files? To avoid repeating the same line eg url =
> > os.environ['HTTP_HOST'] if os.environ.get('HTTP_HOST') else
>
On Sat, 2010-09-18, Niklasro wrote:
> Hi
> How can I make the visibility of a variable across many methods or
> files? To avoid repeating the same line eg url =
> os.environ['HTTP_HOST'] if os.environ.get('HTTP_HOST') else
> os.environ['SERVER_NAME'] I repeat for many methods. So declaring it
>
On 18 sep, 17:25, Niklasro wrote:
> Hi
> How can I make the visibility of a variable across many methods or
> files? To avoid repeating the same line eg url =
> os.environ['HTTP_HOST'] if os.environ.get('HTTP_HOST') else
> os.environ['SERVER_NAME']
First learn to use Python correctly:
url =
15 matches
Mail list logo