This version is a bit better, since it follows the convention that '<<' should return self.
class TestValue(object): """Class to support assignment and test in single operation""" def __init__(self,v=None): self.value = v """Add support for quasi-assignment syntax using '<<' in place of '='.""" def __lshift__(self,other): self.value = other return self def __bool__(self): return bool(self.value) __nonzero__ = __bool__ -- Paul -- http://mail.python.org/mailman/listinfo/python-list