Assigning a value to single underscore _ in Python/IPython interpreter

前端 未结 3 1480
走了就别回头了
走了就别回头了 2020-12-08 03:33

I created this function in Python 2.7 with ipython:

def _(v):
    return v

later if I call _(somevalue), I get

3条回答
  •  误落风尘
    2020-12-08 04:14

    If you create a variable assigned to "_" it gets masked/masks the system variable _.

提交回复
热议问题