[Bengt Richter] > how about (untested) > > def get_options(opts): > """Return True or False if an option is set or not""" > return [1 for val in vars(opts).values() if val is not None] and True or > False
While we're tossing around hacks and coding atrocities, we should note that: not not x outperforms: x and True or False neither of which is as clear as: bool(x) Raymond -- http://mail.python.org/mailman/listinfo/python-list