Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #46172 > unrolled thread
| Started by | Cameron Simpson <cs@zip.com.au> |
|---|---|
| First post | 2013-05-27 16:13 +1000 |
| Last post | 2013-05-27 16:13 +1000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Short-circuit Logic Cameron Simpson <cs@zip.com.au> - 2013-05-27 16:13 +1000
| From | Cameron Simpson <cs@zip.com.au> |
|---|---|
| Date | 2013-05-27 16:13 +1000 |
| Subject | Re: Short-circuit Logic |
| Message-ID | <mailman.2235.1369635220.3114.python-list@python.org> |
On 27May2013 06:59, Vito De Tullio <vito.detullio@gmail.com> wrote: | Cameron Simpson wrote: | > if s is not None and len(s) > 0: | > ... do something with the non-empty string `s` ... | > | > In this example, None is a sentinel value for "no valid string" and | > calling "len(s)" would raise an exception because None doesn't have | > a length. | | obviously in this case an `if s: ...` is more than sufficient :P :P My fault for picking too similar a test. Cheers, -- Cameron Simpson <cs@zip.com.au> Death is life's way of telling you you've been fired. - R. Geis
Back to top | Article view | comp.lang.python
csiph-web