On 27May2013 06:59, Vito De Tullio <vito.detul...@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 <c...@zip.com.au> Death is life's way of telling you you've been fired. - R. Geis -- http://mail.python.org/mailman/listinfo/python-list