Re: [Tutor] threading.currentThread() always same across request ?

2007-04-14 Thread Arun Kumar PG
Thx guys. now quick question on the usage of thread local storage. In my case I have the below object model: class Base(object):' def __init__(self): self.__service = None def _GetService(): if not hasattr(threading.currentThread(), 'service'): threading.currentThread().service = S

Re: [Tutor] threading.currentThread() always same across request ?

2007-04-14 Thread Kent Johnson
Andreas Kostyrka wrote: > * Kent Johnson <[EMAIL PROTECTED]> [070414 19:53]: >> That's a good point. Does anyone know when to prefer threading.local() >> vs thread attributes? > It's design question, I guess: > > *) if you have thread subclasses, then use thread attributes. > *) if you have stand

[Tutor] Seeking python projects

2007-04-14 Thread Asrar Kadri
Hi folks, I want to practice Python programming by developing complete applications. Where can I get such problems, which can improve my Python programming skills. Thanks in anticipation. Regards, Asrar ___ Tutor maillist - [EMAIL PROTECTED] http:

Re: [Tutor] threading.currentThread() always same across request ?

2007-04-14 Thread Andreas Kostyrka
* Kent Johnson <[EMAIL PROTECTED]> [070414 19:53]: > Andreas Kostyrka wrote: > > * Kent Johnson <[EMAIL PROTECTED]> [070414 19:30]: > >> Rather than store your attributes directly in the thread, it would > >> probably be better to use a threading.local() object as the container. > >> http://docs.p

Re: [Tutor] threading.currentThread() always same across request ?

2007-04-14 Thread Kent Johnson
Andreas Kostyrka wrote: > * Kent Johnson <[EMAIL PROTECTED]> [070414 19:30]: >> Rather than store your attributes directly in the thread, it would >> probably be better to use a threading.local() object as the container. >> http://docs.python.org/lib/module-threading.html#l2h-3416 >> >> I don't re

Re: [Tutor] threading.currentThread() always same across request ?

2007-04-14 Thread Andreas Kostyrka
* Kent Johnson <[EMAIL PROTECTED]> [070414 19:30]: > Arun Kumar PG wrote: > > Guys, > > > > I have a web application and I want to store an object per request so > > thta that is available across all classes till end of request. > > > > I am planning to write the below code in my entry program

Re: [Tutor] help on raw_input()

2007-04-14 Thread ammar azif
Thanks the encode method really helps. Alan Gauld <[EMAIL PROTECTED]> wrote: "ammar azif" wrote > Actually i wanted to write a http client using just he low level > socket module. I won;t ask why! But the httplib module probably does what you want just in case you dodn't realize it existed...

Re: [Tutor] help on raw_input()

2007-04-14 Thread Alan Gauld
"ammar azif" <[EMAIL PROTECTED]> wrote > Actually i wanted to write a http client using just he low level > socket module. I won;t ask why! But the httplib module probably does what you want just in case you dodn't realize it existed... > The program will prompt the user asking for input and th

Re: [Tutor] reassign

2007-04-14 Thread Alan Gauld
"linda.s" <[EMAIL PROTECTED]> wrote >I wonder how to use colors from gray to black to represent a group of > values from small to large? Can you explain what you mean? Normally colours are represented in code as a tuple of three numbers for the RGB values. If its shades of grey then all three num

Re: [Tutor] help on raw_input()

2007-04-14 Thread Kent Johnson
ammar azif wrote: > Hi, > > i wanted to get a string from raw_input like this > > raw_input('>') > > \n\nsomestring > > but the problem is raw input will return the string > '\\n\\nsomestring' This is a bit confusing to talk about because the actual contents of the string differ from what is

Re: [Tutor] threading.currentThread() always same across request ?

2007-04-14 Thread Kent Johnson
Arun Kumar PG wrote: > Guys, > > I have a web application and I want to store an object per request so > thta that is available across all classes till end of request. > > I am planning to write the below code in my entry program which is > executed as soon as a request comes: > > entry.py >

Re: [Tutor] help on raw_input()

2007-04-14 Thread ammar azif
Actually i wanted to write a http client using just he low level socket module. The program will prompt the user asking for input and the use will type http commands like 'GET /index.html HTTP/1.0\r\nHost: somehost\r\n\r\n' when i use the raw_input function , the string that i get is 'GET /index.

Re: [Tutor] help on raw_input()

2007-04-14 Thread Alan Gauld
"ammar azif" <[EMAIL PROTECTED]> wrote > i wanted to get a string from raw_input like this > > raw_input('>') >> \n\nsomestring OK, Can you explain precisely what you want the string to contain. \n is the string representation of a newline. Do you want to enter something that starts with two ne

Re: [Tutor] Command line args

2007-04-14 Thread Alan Gauld
"Teresa Stanton" <[EMAIL PROTECTED]> wrote > No one suggested this. That's great! Wish I had seen it sooner. > Thanks, > I'll put that in my notebook for further use later. Note that Fileinput is used to iterate over a (set of) file line by line, it doesn't read the entire file into a string

Re: [Tutor] reassign

2007-04-14 Thread linda.s
I wonder how to use colors from gray to black to represent a group of values from small to large? Thanks, Linda ___ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor

[Tutor] help on raw_input()

2007-04-14 Thread ammar azif
Hi, i wanted to get a string from raw_input like this raw_input('>') > \n\nsomestring but the problem is raw input will return the string '\\n\\nsomestring' My question is Are there any function to convert back those string to '\n\nsomestring' ? Thanks --