473,408 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Python based http server

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

Jul 18 '05 #1
9 4323
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

Jul 18 '05 #2
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


Jul 18 '05 #3
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 <zr*******@sneakemail.com> 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


Jul 18 '05 #4
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 <zr*******@sneakemail.com> wrote in message
news:3F**************@sneakemail.com...
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

Jul 18 '05 #5
Matthew Wilson <mw*****@sarcastic-horse.com> 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
Jul 18 '05 #6
Doug <zr*******@sneakemail.com> 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
Jul 18 '05 #7
|> 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 <al*****@yahoo.com> 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.

Jul 18 '05 #8
Doug <zr*******@sneakemail.com> wrote in
news:3F**************@sneakemail.com:
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 du****@rcp.co.uk
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?
Jul 18 '05 #9
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
Jul 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Patrick Useldinger | last post by:
Hi all, after my unsuccessful try to run Apache 2 with mod_python and Python 2.3, I am looking for an alternative approach. My aim is to write a small web-based application: Python - the...
11
by: Nick Keighley | last post by:
I'm probably missing something rather obvious, but is there a known problem with getting a Python based socket program to communicate with a C based socket program? A simple echo server written in...
0
by: Emile van Sebille | last post by:
QOTW (advanced interfaces track): "I'm firmly in favour of any language that can DWIMNWIS." -- Tim Delaney QOTW (MS roadkill track): "Underestimate MS at your own risk. It is one thing to not...
0
by: Emile van Sebille | last post by:
QOTW: There are probably many less productive ways to spend your time than studying Mark Pilgrim's code. -- Skip Montanaro QOTW: 'enumerate'...? As in, enumerate(n*) ... ? -- Alex Martelli,...
13
by: Ajay | last post by:
hi! can you call a Python application from a Java program? does this require any additional package to be installed? thanks cheers
29
by: 63q2o4i02 | last post by:
Hi, I'm interested in using python to start writing a CAD program for electrical design. I just got done reading Steven Rubin's book, I've used "real" EDA tools, and I have an MSEE, so I know what...
28
by: H J van Rooyen | last post by:
Hi, I want to write a small system that is transaction based. I want to split the GUI front end data entry away from the file handling and record keeping. Now it seems almost trivially easy...
7
by: Chris | last post by:
I have an database containing lots of numerical data. I want to write a browser based interface that will allow selection of various key parameters and yield tables, plots and/or printouts of the...
5
by: walterbyrd | last post by:
I don't know much php either, but running a php app seems straight forward enough. Python seems to always use some sort of development environment vs production environment scheme. For...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.