On Fri, Nov 25, 2011 at 5:52 PM, ZhouPeng <zpeng...@gmail.com> wrote: > I am sure listen is not None and can be accessed properly. > > But print bool(listen) is False > if not listen is True
Casting something to boolean follows strict rules derived from the notion that emptiness is false and nonemptiness is true. For instance: >>> bool(""),bool([]),bool({}),bool(0) (False, False, False, False) Details here: http://docs.python.org/library/stdtypes.html Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list