What is __return__?

前端 未结 3 1551
失恋的感觉
失恋的感觉 2020-12-29 08:13

I am debugging a script in Python 3.1 and discovered this:

(Pdb) p locals() {\'count\': 264, \'self\': , \'depth\': 1, \'offset\': 0, \'_

3条回答
  •  清酒与你
    2020-12-29 08:46

    The __return__ keyword only appears in the debugger code:

    matt@stanley:~/src/Python-3.2$ grep -R __return__ .
    ./Lib/pdb.py:        frame.f_locals['__return__'] = return_value
    ./Lib/pdb.py:        if '__return__' in self.curframe_locals:
    ./Lib/pdb.py:            self.message(repr(self.curframe_locals['__return__']))
    ./Lib/bdb.py:        if '__return__' in frame.f_locals:
    ./Lib/bdb.py:            rv = frame.f_locals['__return__']
    

提交回复
热议问题