def perspective_do(self, expr):
        """Evaluate the given expression, with output to the console.

        The result is stored in the local variable '_', and its repr()
        string is sent to the console as a \"result\" message.
        """
        log.msg(">>> %s" % expr)
        val = self.runInConsole(expr)
        if val is not None:
            self.localNamespace["_"] = val
            from twisted.internet.defer import Deferred
            # TODO: client support for Deferred.
            if isinstance(val, Deferred):
                self.lastDeferred += 1
                self.console([('result', "Waiting for Deferred #%s...\n" % self.lastDeferred)])
                val.addBoth(self._cbResult, self.lastDeferred)
            else:
                self.console([("result", repr(val) + '\n')])
        log.msg("<<<")
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/manhole/service.py/Perspective.perspective_do/original