Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Python based http server

Reply
Thread Tools

Python based http server

 
 
Doug
Guest
Posts: n/a
 
      10-12-2003
I am thinking of using a Python based HTTP server instead of Apache.

I would be interested in one that employed generators and coroutines. I
know those are fairly new features of python, so maybe nothing is
available yet.

Doug

 
Reply With Quote
 
 
 
 
Alex Martelli
Guest
Posts: n/a
 
      10-12-2003
Doug wrote:

> I am thinking of using a Python based HTTP server instead of Apache.
>
> I would be interested in one that employed generators and coroutines. I
> know those are fairly new features of python, so maybe nothing is
> available yet.


coroutines are not a part of Python. Twisted, the best way to write
standalone Python HTTP servers, can use generators productively,
see e.g. http://twistedmatrix.com/documents/howto/flow (but it will
make little sense to you until you understand more about Twisted).


Alex

 
Reply With Quote
 
 
 
 
Doug
Guest
Posts: n/a
 
      10-12-2003
I thought the yield thing in Python 2.3 was a couritine implementation.
Is there a difference between generators and coroutines?




Alex Martelli wrote:

> Doug wrote:
>
>
>>I am thinking of using a Python based HTTP server instead of Apache.
>>
>>I would be interested in one that employed generators and coroutines. I
>>know those are fairly new features of python, so maybe nothing is
>>available yet.

>
>
> coroutines are not a part of Python. Twisted, the best way to write
> standalone Python HTTP servers, can use generators productively,
> see e.g. http://twistedmatrix.com/documents/howto/flow (but it will
> make little sense to you until you understand more about Twisted).
>
>
> Alex
>


 
Reply With Quote
 
Matthew Wilson
Guest
Posts: n/a
 
      10-12-2003
What's the advantage of writing your own HTTP server vs using Apache +
mod_python?


On Sun, 12 Oct 2003 16:59:23 GMT
Doug <(E-Mail Removed)> wrote:

> I am thinking of using a Python based HTTP server instead of Apache.
>
> I would be interested in one that employed generators and coroutines. I
> know those are fairly new features of python, so maybe nothing is
> available yet.
>
> Doug
>
> --
> http://mail.python.org/mailman/listinfo/python-list


 
Reply With Quote
 
Jegenye 2001 Bt
Guest
Posts: n/a
 
      10-12-2003
Yes, coroutines are more general than generators.
The code execution is always resumed from the point of calling with
generators, while with coroutines that's not the case.

Regards,
Miklós

--
Prisznyák Miklós
---
Jegenye 2001 Bt. ( jegenye2001 at (NoSPAM)parkhosting dot com )
Egyedi szoftverkészítés, tanácsadás
Custom software development, consulting
http://jegenye2001.parkhosting.com


Doug <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I thought the yield thing in Python 2.3 was a couritine implementation.
> Is there a difference between generators and coroutines?
>
>
>
>
> Alex Martelli wrote:
>
> > Doug wrote:
> >
> >
> >>I am thinking of using a Python based HTTP server instead of Apache.
> >>
> >>I would be interested in one that employed generators and coroutines. I
> >>know those are fairly new features of python, so maybe nothing is
> >>available yet.

> >
> >
> > coroutines are not a part of Python. Twisted, the best way to write
> > standalone Python HTTP servers, can use generators productively,
> > see e.g. http://twistedmatrix.com/documents/howto/flow (but it will
> > make little sense to you until you understand more about Twisted).
> >
> >
> > Alex
> >

>



 
Reply With Quote
 
Wilk
Guest
Posts: n/a
 
      10-12-2003
Matthew Wilson <(E-Mail Removed)> writes:

> What's the advantage of writing your own HTTP server vs using Apache +
> mod_python?


Why take a ham to scratch a poor fly ?

You even can make a complete server in a windows exe ! hu ! incredible
isn'it ?

And the server will be faster...

--
Wilk - http://flibuste.net
 
Reply With Quote
 
David Mertz
Guest
Posts: n/a
 
      10-12-2003
|> I would be interested in one that employed generators and coroutines. I
|> know those are fairly new features of python, so maybe nothing is
|> available yet.

Alex Martelli <(E-Mail Removed)> wrote previously:
|coroutines are not a part of Python. Twisted, the best way to write
|standalone Python HTTP servers, can use generators productively,

Twisted certainly has some virtures. But semi-coroutines, at least, are
part of Python--and therefore it's easy to build full coroutines. See:

http://gnosis.cx/publish/programming...python_b5.html

It's certainly quite possible to use those for a somewhat different
switching framework than Twisted gives you.

Yours, David...

--
Keeping medicines from the bloodstreams of the sick; food from the bellies
of the hungry; books from the hands of the uneducated; technology from the
underdeveloped; and putting advocates of freedom in prisons. Intellectual
property is to the 21st century what the slave trade was to the 16th.

 
Reply With Quote
 
John J. Lee
Guest
Posts: n/a
 
      10-12-2003
Doug <(E-Mail Removed)> writes:

> I thought the yield thing in Python 2.3 was a couritine
> implementation. Is there a difference between generators and
> coroutines?


Yes. Never used coroutines, so not going to explain that, but
coroutines were (and are, I guess, but not certain) part.of Stackless
Python. Stackless is a separate Python implementation, forked from
CPython. It's currently going through big changes.


John
 
Reply With Quote
 
Duncan Booth
Guest
Posts: n/a
 
      10-13-2003
Doug <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> I thought the yield thing in Python 2.3 was a couritine implementation.
> Is there a difference between generators and coroutines?


(please don't top quote)

Coroutines have a completely separate stack which is saved when they yield,
so you have a load of nested function calls and yield from deep in the
middle of them.

Generators save only a single stack frame, so all yields must come directly
from the generator, not from functions which it calls.

You can use generators to get a similar effect to coroutines by nesting
generators and propogating the yields back up the chain, but this has to be
done explicitly at every level.

--
Duncan Booth http://www.velocityreviews.com/forums/(E-Mail Removed)
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
 
Reply With Quote
 
Peter Hansen
Guest
Posts: n/a
 
      10-14-2003
Doug wrote:
>
> I am thinking of using a Python based HTTP server instead of Apache.
>
> I would be interested in one that employed generators and coroutines. I
> know those are fairly new features of python, so maybe nothing is
> available yet.


Given your expressed requirements: avoiding Apache and using generators,
it sounds a lot like you are doing this merely as a learning experience
or something. After all, who ever heard of "uses generators" as a
practical requirement for a web server?

If you have real requirements, let us know. Otherwise the only
good "advice" you will hear is "what's wrong with Apache"?

-Peter
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HTTP SOAP/HTTP GET/HTTP POST milan_9211 Software 0 01-10-2011 02:10 PM
The Web server reported the following error when attempting to create or open the Web project located at the following URL: 'http://localhost/822319ev1'. 'HTTP/1.1 500 Internal Server Error'. chanmm ASP .Net 2 09-07-2010 07:37 AM
multitask http server (single-process multi-connection HTTP server) lkcl Python 6 07-15-2010 10:39 PM
Can I change the response URL to http://server/page.XLS instead of http://server/page.ASPX ? guillermojco@gmail.com ASP .Net 3 04-26-2007 04:49 AM
Access Based Enumeration - for Intel based server with Server x64 =?Utf-8?B?SVQgU2Ft?= Windows 64bit 4 03-07-2007 02:51 AM



Advertisments