A certainl part of an if() structure never gets executed.

alex23 wuwei23 at gmail.com
Wed Jun 12 02:16:53 EDT 2013


On Jun 12, 3:44 pm, Tim Roberts <t... at probo.com> wrote:
> It seems silly to fire up a regular expression compiler to look for a
> single character.
>     if name.find('=') < 0 and month.find('=') < 0 and year.find('=') < 0:

If truthiness is the only concern, I prefer using `in`:

    if '=' in name and '=' in month ...



More information about the Python-list mailing list