Pythonic way of web-programming

Ian Bicking ianb at colorstudy.com
Sun Apr 6 14:33:01 EDT 2003


On Sun, 2003-04-06 at 12:44, Graham Fawcett wrote:
> Neil Schemenauer <nas-usenet at arctrix.com> wrote in message news:<%5Oja.10776$7w2.9784 at nwrddc01.gnilink.net>...
> > Ian Bicking <ianb at colorstudy.com> wrote:
> > > The next step I can envision would be for Twisted to become the
> > > canonical infrastructure, where higher-level web frameworks are all
> > > built ontop of it.
> > 
> > That's not feasible.  Some applications would require extensive
> > modification to work on top of an event driven framework.
> > 
> >   Neil
> 
> Neil, I may just be suffering from
> daylight-savings-adjustment-syndrome, but what kinds of applications?
> We are talking only about Web application frameworks, which are
> request handlers and are therefore event-driven by definition.

In the Twisted/async model everything that's not really fast has to be
done with events.  So instead of doing:

f = open("somefile")
contents = f.read()
unsafeHTML.sub('', contents)
...

You would do that with events and callbacks.  I can't give a good
example of the translation because I'm not well-versed in that sort of
programming, but you'd compose it as a number of functions, with the
file read calling those functions once it's been completed.

It's pretty weird, and yes it isn't feasable, but luckily you don't have
to use that style to use Twisted (just if you want to program Twisted
protocols).

  Ian







More information about the Python-list mailing list