On 2007-09-08, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > Lawrence D'Oliveiro wrote: >>>>> if y[0]: >>>> Not a good idea. >>> Why not? >> >> Because there is a situation where your version of the test >> will fail even if the first element of y is non-null. > > Such as? Seriously people, a little more verbosity wouldn't > hurt here. This isn't a mystery game.
>>> if "": True ... >>> if 0: True ... >>> if []: True ... >>> if {}: True ... >>> if None: True ... That's may not be all the possibilities. Lots of Python objects can evaluate to false in a boolean context. -- Neil Cerutti The Pastor would appreciate it if the ladies of the congregation would lend him their electric girdles for the pancake breakfast next Sunday morning. --Church Bulletin Blooper -- http://mail.python.org/mailman/listinfo/python-list