On Sun, Jul 24, 2011 at 2:07 AM, Steven D'Aprano <st...@pearwood.info>wrote:

> (Note that among strings, only the empty string counts as nothing. The
> strings 'nothing', 'empty', 'false', 'not a thing', 'nada', 'not a brass
> farthing', "dry as a dingo's donger" etc. are non-empty strings and
> therefore count as true-values.)
>

Though just for completeness sake, you could do something like:

def mytest(string):
    if string.lower() in ("nothing", "empty", "false", "not a thing",
"nada", "not a brass farthing", "dry as a dingo's donger"):
        return False
    else:
        return True

if you were really interested in using values such as those.

Personally, just for kicks and giggles, when I write personal programs and I
ask for "Y/N" input, I'm fairly liberal - so instead of N you could input N,
No, nyet, no way, no thanks... you get the picture.

My 1 cent and pocket lint,
-Wayne
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to