473,698 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4344
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*******@snea kemail.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)parkhos ting dot com )
Egyedi szoftverkészíté s, tanácsadás
Custom software development, consulting
http://jegenye2001.parkhosting.com
Doug <zr*******@snea kemail.com> wrote in message
news:3F******** ******@sneakema il.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*****@sarcas tic-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*******@snea kemail.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*******@snea kemail.com> wrote in
news:3F******** ******@sneakema il.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.u k
int month(char *p){return(1248 64/((p[0]+p[1]-p[2]&0x1f)+1)%12 )["\5\x8\3"
"\6\7\xb\1\x9\x a\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
3174
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 solution must be based / usable on Python 2.3 Portability Targeted plaforms are
11
10087
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 Python (the example from Python in a Nutshell actually) will happily talk to a Python based client. If a C based client is substitued the connection is refused (or so the C client reports). The C client will talk to a C server. --
0
1561
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 like MS, and possibly a reasonable position to take. However, underestimating them is for fools." -- Mark Hammond, on Microsoft's commitment to .net. Anthony Baxter releases Python 2.3.3 final.
0
1141
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, a complete response quoted! Stephen Ferg announces a Python Language Reference, his produce a complete, alphabetized reference of all of Python's language features.=20
13
3338
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
16554
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 I *want* at the end of this; I just have never taken on a programming task of this magnitude. I've seen that some are using python as a utility language for existing CAD environments, and I've also found some guy who's writing a 2d drafting...
28
2628
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 using the sockets module to communicate between machines on the same LAN, so that I want to do the record keeping on one machine.
7
1895
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 data according to the selections. Ultimately I want this to run on an intranet so that others can get access via their browsers. The application is for in-house use only and not likely to have more than a few users at any one time. I've managed...
5
1640
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 development, you are supposed to run a local browser and load 127.0.0.1:5000 - or something like that. Then to run the same thing in a development environment, I have to configure some files, or touch all the files, restart the web-server, or something....
0
9170
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8901
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7739
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4371
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2336
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.