Hi, all I would like some feedback on a multithreaded HTTP server I've
written. The server serves python-scripts by dynamically loading scripts
in the same directory as itself. When a request is made to one of these
scripts the script is executed and its output is returned to the
requester.
Here
mwt <[EMAIL PROTECTED]> wrote:
>1) Is this good Python code? What should be changed to make it more
>Pythonesque?
>while not len(self.stacks) > 0:
while not self.stacks:
An empty list is considered to be false, hence testing the list
itself is the same as testing len(l) > 0 .
--
Jorgen Grahn wrote:
> You might want to look into using doc strings properly. You have comments at
> the start of functions, but they read more like implementation notes than
> "what this method does and why". But I only had a quick look.
Yeah. They were just my scaffolding notes to myself.
I'd
Thanks for all the feedback.
Interestingly, I can't seem to get Dan M's code:
[code]
try:
while 1:
pass
except KeyboardInterrupt:
break
[/code]
to work, no matter how many variations I try (including adding in
"time.sleep(0.1)" as Peter Hansen suggested. Th
I believe the while 1: pass is there to keep the main thread alive
until all the readers are done. If you want the program to end after
the readers are done you can append them all to a list then iterate
through and wait for the threads to join()
if __name__=="__main__":
library = Library()
On 6 Feb 2006 09:33:58 -0800, mwt <[EMAIL PROTECTED]> wrote:
> Hello -
> Last night I wrote my first code in Python -- a little
> producer/consumer toy to help me begin to understand things. The
> "Library" only has a few books. You can choose how many Readers are
...
> 1) Is this good Python code?
Dan M wrote:
>>2) Anybody know how to alter the "while 1: pass" section to make the
>>app stoppable?
>
>
> That one I think I can help with! See below.
>
>
>>while 1: pass
>
>
> try:
> while 1:
> pass
> except KeyboardInterrupt:
> break
That migh
> 2) Anybody know how to alter the "while 1: pass" section to make the
> app stoppable?
That one I think I can help with! See below.
> while 1: pass
try:
while 1:
pass
except KeyboardInterrupt:
break
--
http://mail.python.org/mailman/listinf
Hello -
Last night I wrote my first code in Python -- a little
producer/consumer toy to help me begin to understand things. The
"Library" only has a few books. You can choose how many Readers are
trying to check out the books. When no books are available, they have
to wait until some other Reader r