Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #75305
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <shieldfire@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; '(using': 0.07; 'modified': 0.07; 'python3': 0.07; 'lost.': 0.09; 'url:localhost': 0.09; 'yeah,': 0.09; 'cc:addr:python-list': 0.11; 'martin': 0.11; 'python': 0.11; 'def': 0.12; '"hello': 0.16; "'from": 0.16; '*any*': 0.16; 'generator.': 0.16; 'preserves': 0.16; 'quit.': 0.16; 'route,': 0.16; 'wrote:': 0.18; "hasn't": 0.19; 'version.': 0.19; '>>>': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'url:dev': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'chris': 0.29; '[1]': 0.29; 'am,': 0.29; 'skip:@ 10': 0.30; 'message- id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; '(which': 0.31; 'code': 0.31; 'run': 0.32; 'url:python': 0.33; 'framework': 0.33; 'url:non-standard http port': 0.33; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'yield': 0.36; 'url:listinfo': 0.36; 'similar': 0.36; 'url:org': 0.36; 'list.': 0.37; 'starting': 0.37; 'server': 0.38; 'list,': 0.38; 'skip:p 20': 0.39; 'called': 0.40; 'url:mail': 0.40; 'skip:u 10': 0.60; 'temporarily': 0.60; 'more': 0.64; 'jul': 0.74; 'listening': 0.74; '127.0.0.1': 0.84; 'otten': 0.84; 'suspicion': 0.84; 'to:none': 0.92; 'state.': 0.95 |
| 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=3KhtrEuMH2QwDWnzdg/1mrCm7R4ceRxFzsiTAKS/AHg=; b=Wt4nt22W7+rPn1IKw1PzCsjLjX6jJ2XgpkMbePLiOnBHTg7Uk0+V5yD6lWhym9w+t+ V5JzFpuvARPi/NcP6z1n0x/ImssFnweJmcHOjssTu+zI5TG/DRpebrruDOY4IHjqrHii CnPjXm6OnU/pK0O6dTzcYqkrYSGvdpaDxpK4vlg89v4vgzj4JxZVpQ4z0Z/ag0ZeAi56 TXm8FnfMfIJli0FiP24s0jMxfGd2xW7JSIq85V4Fr4cLmrRtH28CHpJFdaYxufAN7sfP btLg6OvMW7WfdH3JtBjP1DJU2JU7Gbjlas8nJTlMZFrxhOUH4SMzt98nPRrrfL/spEtF 7BEQ== |
| MIME-Version | 1.0 |
| X-Received | by 10.52.154.106 with SMTP id vn10mr34980408vdb.36.1406534040924; Mon, 28 Jul 2014 00:54:00 -0700 (PDT) |
| In-Reply-To | <lr4sv7$l3j$1@ger.gmane.org> |
| References | <CAHXoDSB=W3S4gwc7aJO2AA6gtkz5VGQ5=y7hZ5tLL32AamjmXQ@mail.gmail.com> <CAPTjJmrdqBwuiuJHSAGCjRZoWsQzi_iFVJe=XD3m0nbGa9w_Cg@mail.gmail.com> <lr3f5l$e4h$1@ger.gmane.org> <CAPTjJmqZC7YpaNzNRZrVgguBbpOsYS=arkydG_5n3n8EY_G=3g@mail.gmail.com> <lr4sv7$l3j$1@ger.gmane.org> |
| Date | Mon, 28 Jul 2014 09:54:00 +0200 |
| Subject | Re: complete brain fart, it doesn't loop |
| From | Martin S <shieldfire@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.12383.1406534049.18130.python-list@python.org> (permalink) |
| Lines | 54 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1406534049 news.xs4all.nl 2867 [2001:888:2000:d::a6]:43026 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:75305 |
Show key headers only | View raw
That's neat. I was only aware of the return version.
Anyway, got it working now, simplifying the code in the process. So
all was not lost.
/Martin S
2014-07-28 9:09 GMT+02:00 Peter Otten <__peter__@web.de>:
> Chris Angelico wrote:
>
>> On Mon, Jul 28, 2014 at 4:07 AM, Peter Otten <__peter__@web.de> wrote:
>>> By the way, Python has something similar to a function that temporarily
>>> interrupts execution but preserves state. It's called generator.
>>
>> Yeah, but I have a suspicion his web framework (which he hasn't
>> identified, but I suspect *any* web framework) won't be looking for a
>> generator :) More likely, what he wants is to collect up the return
>> values in a list, and then return ''.join() that list.
>
> It was just a guess, but as the OP uses bottle, here's a modified
> "hello world" from the bottle site
> <http://bottlepy.org/docs/dev/tutorial.html#quickstart-hello-world>:
>
> $ cat app.py
> from bottle import route, run
>
> @route('/hello')
> def hello():
> yield "Hello "
> yield "World!"
>
> run(host='localhost', port=8080, debug=True)
> $ python3 app.py &
> [1] 3203
> $ Bottle v0.12.7 server starting up (using WSGIRefServer())...
> Listening on http://localhost:8080/
> Hit Ctrl-C to quit.
>
>
> $ python3 -c 'from urllib.request import urlopen; print(urlopen("http://localhost:8080/hello").read())'
> 127.0.0.1 - - [28/Jul/2014 09:07:15] "GET /hello HTTP/1.1" 200 12
> b'Hello World!'
> $
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
--
Regards,
Martin S
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: complete brain fart, it doesn't loop Martin S <shieldfire@gmail.com> - 2014-07-28 09:54 +0200
csiph-web