Why does returning in Interactive Python print to sys.stdout?

后端 未结 5 1461
挽巷
挽巷 2021-01-16 04:18

I ran into something different today. Consider this simple function:

def hi():
    return \'hi\'

If I call it in a Python shell,

         


        
5条回答
  •  逝去的感伤
    2021-01-16 04:39

    It is a feature of the interactive shell. Yes, it is supposed to happen. The benefit is that it makes interactive development more convenient.

提交回复
热议问题