Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > de.comp.lang.python > #4326
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Dinu Gherman <gherman@darwin.in-berlin.de> |
| Newsgroups | de.comp.lang.python |
| Subject | Re: [Python-de] Schleifen die ohne Durchlaufen des Schleifenkörpers beendet wurden |
| Date | Thu, 24 Mar 2016 22:22:00 +0100 |
| Lines | 27 |
| Message-ID | <mailman.110.1458854701.2244.python-de@python.org> (permalink) |
| References | <56F445C9.3000200@mail.de> <CAMSP2L7OBP5h4yjrRrx4XuvwE3UMTg=grZqPzJ7B9ZEyYYXD5A@mail.gmail.com> <E7199327-B882-4691-A703-351C20DFE173@web.de> |
| Mime-Version | 1.0 (Apple Message framework v1085) |
| Content-Type | text/plain; charset=windows-1252 |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | news.uni-berlin.de lrduiF45iy0tfG5LbFvWLQ5jKZhou1pVReUs841vvqmg== |
| Return-Path | <gherman@darwin.in-berlin.de> |
| X-Original-To | python-de@python.org |
| Delivered-To | python-de@mail.python.org |
| X-Envelope-From | gherman@darwin.in-berlin.de |
| In-Reply-To | <E7199327-B882-4691-A703-351C20DFE173@web.de> |
| X-Mailer | Apple Mail (2.1085) |
| X-BeenThere | python-de@python.org |
| X-Mailman-Version | 2.1.21 |
| Precedence | list |
| List-Id | Die Deutsche Python Mailingliste <python-de.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-de>, <mailto:python-de-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-de/> |
| List-Post | <mailto:python-de@python.org> |
| List-Help | <mailto:python-de-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-de>, <mailto:python-de-request@python.org?subject=subscribe> |
| Xref | csiph.com de.comp.lang.python:4326 |
Show key headers only | View raw
Diez B. Roggisch:
> Aber for/else… hach, das waere schon schoen gewesen.
Wohl wahr... Nicht schön, aber quasi-funktional ist vielleicht Folgendes:
In [1]: def do(item): print(item)
In [2]: def empty(): print('no luck')
In [3]: _ = len([do(item) for item in [1, 2, 3]]) or empty()
1
2
3
In [4]: _ = len([do(item) for item in []]) or empty()
no luck
Die Zuweisung nur, damit es keine Ausgabe gibt...
Gruß,
Dinu
Back to de.comp.lang.python | Previous | Next | Find similar
Re: [Python-de] Schleifen die ohne Durchlaufen des Schleifenkörpers beendet wurden Dinu Gherman <gherman@darwin.in-berlin.de> - 2016-03-24 22:22 +0100
csiph-web