Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #85147
| Return-Path | <rosuav@gmail.com> |
|---|---|
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.018 |
| X-Spam-Evidence | '*H*': 0.96; '*S*': 0.00; 'callback': 0.09; 'high- level': 0.09; 'sure,': 0.09; 'used.': 0.09; 'subject:How': 0.10; 'cc:addr:python-list': 0.11; 'python': 0.11; 'mostly': 0.14; 'times,': 0.14; "wouldn't": 0.14; 'windows': 0.15; 'blocking': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'handlers.': 0.16; 'intrinsic': 0.16; 'models,': 0.16; 'non- blocking': 0.16; 'sockets': 0.16; 'subject:non': 0.16; 'think.': 0.16; 'subject: ?': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'wed,': 0.18; "python's": 0.19; 'things.': 0.19; 'feb': 0.22; 'code,': 0.22; 'platforms': 0.22; 'programming': 0.22; 'cc:addr:python.org': 0.22; "aren't": 0.24; 'certainly': 0.24; 'convenient': 0.24; 'lets': 0.24; '(or': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'defined': 0.27; 'header:In-Reply-To:1': 0.27; 'external': 0.29; 'am,': 0.29; 'mix': 0.30; 'programming.': 0.30; 'said,': 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'bad.': 0.31; 'bunch': 0.31; 'commonly': 0.31; 'exceptions': 0.31; 'another': 0.32; 'older': 0.33; 'used,': 0.33; 'comment': 0.34; 'problem': 0.35; 'common': 0.35; 'tool': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'done': 0.36; 'doing': 0.36; 'useful': 0.36; 'possible': 0.36; 'sometimes': 0.38; 'server': 0.38; 'structure': 0.39; 'though,': 0.39; 'catch': 0.60; 'most': 0.60; 'effective': 0.61; 'matter': 0.61; 'strictly': 0.61; 'simply': 0.61; 'such': 0.63; 'networking': 0.64; 'more': 0.64; 'different': 0.65; 'facilities': 0.69; 'wish': 0.70; 'therefore': 0.72; '2015': 0.84; 'coexist': 0.84; 'concept.': 0.84; 'cpu,': 0.84; 'pike': 0.84; 'aka': 0.91; 'care,': 0.91; 'facilities.': 0.91; 'subject:skip:S 20': 0.91; 'to:none': 0.92; 'wanting': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=eOf61jH64KyosPel8ZeeuYj4NxVOB3hbEXJBSpvYlfQ=; b=l1Pi3Q/tl5YErLXy6MwuxSSoybWMBpTRnQwbRcQErkfd5cA3u9PZ8sVyAGqD0LIIfh 5jn7lGd8z0ydWQyhESq+qITjqwkMbef0cuWieVKXLtrIZSqVY9GD6WuNFPCb4GnhqIDq mXWYqsoBHKuqD/+NAKFLQMHn6fZEBn9ZnQnlU/5qtX3ziG45UmIxVlJiqkUhMa6RB38m SijZk5BWzIuAHBh24GwY7/1OKqxAUg1jTMXam4Rp8X5bNHyHNT0eEzCvUO19F5E/Fiqa kVgXt84IWULO37JLKzln73t37Bh3WP1m8/XrwOEJoKLiWTIVrRtx+twu9FtmDrxwymqj ogwg== |
| MIME-Version | 1.0 |
| X-Received | by 10.50.171.201 with SMTP id aw9mr18000416igc.2.1422972217327; Tue, 03 Feb 2015 06:03:37 -0800 (PST) |
| In-Reply-To | <87iofjglbg.fsf@elektro.pacujo.net> |
| References | <mailman.18397.1422871634.18130.python-list@python.org> <47031e69-e94d-4257-8c7d-e7c00a543634@googlegroups.com> <874mr3ibve.fsf@elektro.pacujo.net> <c0e17d52-4978-48fd-8848-30426ea42e14@googlegroups.com> <mailman.18420.1422960897.18130.python-list@python.org> <b6cb0fcb-9934-41b6-a8f6-902d26f2588c@googlegroups.com> <mailman.18421.1422961678.18130.python-list@python.org> <87r3u7grd3.fsf@elektro.pacujo.net> <e6d081df-1db0-41a3-905c-e3c2845d5dda@googlegroups.com> <87iofjglbg.fsf@elektro.pacujo.net> |
| Date | Wed, 4 Feb 2015 01:03:37 +1100 |
| Subject | Re: How to write a non blocking SimpleHTTPRequestHandler ? |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.18424.1422972220.18130.python-list@python.org> (permalink) |
| Lines | 45 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1422972220 news.xs4all.nl 2864 [2001:888:2000:d::a6]:35101 |
| X-Complaints-To | abuse@xs4all.nl |
| Path | csiph.com!usenet.pasdenom.info!bete-des-vosges.org!feed.ac-versailles.fr!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
| Xref | csiph.com comp.lang.python:85147 |
Show key headers only | View raw
On Wed, Feb 4, 2015 at 12:45 AM, Marko Rauhamaa <marko@pacujo.net> wrote: >> But your comment is interesting because, as I understand it, a >> non-blocking web server is simply a matter of setting timeouts on >> sockets, catch the exceptions and move on. > > Now I think you might have some misconceptions about nonblocking > networking I/O. Nonblocking I/O is done using asynchronous, or > event-driven, programming. Your code reacts to external stimuli, never > blocking, mostly just sleeping. The reactions are defined in callback > routings, aka listeners, aka event handlers. Not strictly true - that's just one convenient way of doing things. A callback/event-handler structure lets you write a bunch of listeners that coexist effortlessly, but it's not the only way to do non-blocking I/O, and it's certainly not an intrinsic part of the concept. That said, though, it is a VERY convenient way to lay things out in the code. The Pike system I offered, and most of the older multiplexed-I/O systems I've used, did work that way. It just isn't something that non-blocking necessarily implies. >> I don't know why wouldn't that be possible with python stdlib ? > > It is possible using the low-level facilities. However, the traditional > high-level facilities are built on multithreading, which (as a rule) is > based on blocking I/O. Multithreading is another way to cope with the same problem of wanting to deal with different sockets on a single CPU, but I don't think it's inherently a part of any of Python's own high-level facilities - not that I can think of, at least? However, in terms of common programming models, yes, multithreading+blocking I/O is an effective way to write code, and will therefore be commonly used. I wish more people had grown up on OS/2 instead of (or as well as) Windows or Unix. Threading is not such a bugbear as a lot of people seem to think. Yes, some platforms have traditionally had poor implementations, and to be sure, you don't want to mix threading and forking without a *lot* of care, but threads aren't inherently bad. They're a useful tool in the toolbox. Sometimes non-blocking I/O is the right thing to do; sometimes threads suit the problem better; other times, something else again. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: How to write a non blocking SimpleHTTPRequestHandler ? Amirouche Boubekki <amirouche.boubekki@gmail.com> - 2015-02-02 10:07 +0000
Re: How to write a non blocking SimpleHTTPRequestHandler ? Yassine Chaouche <yacinechaouche@yahoo.com> - 2015-02-03 01:08 -0800
Re: How to write a non blocking SimpleHTTPRequestHandler ? Marko Rauhamaa <marko@pacujo.net> - 2015-02-03 11:27 +0200
Re: How to write a non blocking SimpleHTTPRequestHandler ? Yassine Chaouche <yacinechaouche@yahoo.com> - 2015-02-03 02:47 -0800
Re: How to write a non blocking SimpleHTTPRequestHandler ? Chris Angelico <rosuav@gmail.com> - 2015-02-03 21:54 +1100
Re: How to write a non blocking SimpleHTTPRequestHandler ? Yassine Chaouche <yacinechaouche@yahoo.com> - 2015-02-03 03:04 -0800
Re: How to write a non blocking SimpleHTTPRequestHandler ? Chris Angelico <rosuav@gmail.com> - 2015-02-03 22:07 +1100
Re: How to write a non blocking SimpleHTTPRequestHandler ? Yassine Chaouche <yacinechaouche@yahoo.com> - 2015-02-03 03:23 -0800
Re: How to write a non blocking SimpleHTTPRequestHandler ? Marko Rauhamaa <marko@pacujo.net> - 2015-02-03 13:35 +0200
Re: How to write a non blocking SimpleHTTPRequestHandler ? Yassine Chaouche <yacinechaouche@yahoo.com> - 2015-02-03 04:56 -0800
Re: How to write a non blocking SimpleHTTPRequestHandler ? Marko Rauhamaa <marko@pacujo.net> - 2015-02-03 15:45 +0200
Re: How to write a non blocking SimpleHTTPRequestHandler ? Chris Angelico <rosuav@gmail.com> - 2015-02-04 01:03 +1100
Re: How to write a non blocking SimpleHTTPRequestHandler ? Marko Rauhamaa <marko@pacujo.net> - 2015-02-03 16:20 +0200
Re: How to write a non blocking SimpleHTTPRequestHandler ? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-02-03 20:25 -0500
Re: How to write a non blocking SimpleHTTPRequestHandler ? Chris Angelico <rosuav@gmail.com> - 2015-02-04 00:21 +1100
Re: How to write a non blocking SimpleHTTPRequestHandler ? Amirouche Boubekki <amirouche.boubekki@gmail.com> - 2015-02-03 14:09 +0000
Re: How to write a non blocking SimpleHTTPRequestHandler ? Yassine Chaouche <yacinechaouche@yahoo.com> - 2015-02-03 06:50 -0800
Re: How to write a non blocking SimpleHTTPRequestHandler ? Filadelfo Fiamma <philosganga@gmail.com> - 2015-02-03 16:03 +0100
Re: How to write a non blocking SimpleHTTPRequestHandler ? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-02-03 16:39 +0000
Re: How to write a non blocking SimpleHTTPRequestHandler ? Yassine Chaouche <yacinechaouche@yahoo.com> - 2015-02-08 06:13 -0800
Re: How to write a non blocking SimpleHTTPRequestHandler ? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-02-03 12:10 +0000
csiph-web