else clauses in while and for loops

Clarence Gardner clarence at netlojix.com
Sat Apr 15 22:59:20 CEST 2000

On Sat, 15 Apr 2000, Nick Maclaren wrote:
>In article <38F79B93.B03F0A6B at mindspring.com>,
>Chuck Esterbrook  <echuck at mindspring.com> wrote:
>>So did anyone present, in this thread, an example that shows a real need?
>Whether or not they have one, there is a fairly common case:
>    Perform an action XXX provided that no member of sequence YYY
>fulfils a particular criterion.
I never thought of that general wording, but it certainly fits.
I did this just yesterday:

for fname in ('keyword','terms','title','journal','author','pubdate','thd','entrynumber'):
    if Form.has_key(fname):
    Errs.append('No search field supplied')

More information about the Python-list mailing list