I have a method getToken() which checks to see if a value is set, and if so, return it. However, it doesn't feel pythonic to me:

def getToken(self):
    if self.tok:
        t = self.tok
        self.tok = None
        return t
    # ...


Is there a way to trim the 'if' block to reset self.tok upon return?

--
Bill
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to