* pyt...@bdurham.com <pyt...@bdurham.com> [2009-02-16 00:48:34 -0500]:

> Nicolas,
> 
> > I would go for something like:
> > 
> > for char in word:
> >     if char in 'aeiouAEIUO':
> >         char_found = True
> >         break
> > else:
> >     char_found = False
> >
> > It is clear (imo), and it is seems to be the intended idiom for a 
> > search loop, that short-circuits as soon as a match is found.
> 
> Thank you - that looks much better that my overly complicated attempts.
> 
> Are there any reasons why I couldn't simplify your approach as follows?
> 
> for char in word:
>     if char in 'aeiouAEIUO':
>         return True
> return False

If you want to put this in its own function, this seems to be the way to go.

Cheers,
-- 
Nicolas Dandrimont

The nice thing about Windows is - It does not just crash, it displays a
dialog box and lets you press 'OK' first.
(Arno Schaefer's .sig)

Attachment: signature.asc
Description: Digital signature

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to