What is the difference between a statement and a function in Python?

前端 未结 3 1320
礼貌的吻别
礼貌的吻别 2020-12-31 07:54

Edit: The suggested duplicate, does not answer my question, as I am primarily concerned with the difference in Python specifically. The suggested duplicate is far broade

3条回答
  •  轮回少年
    2020-12-31 08:02

    A statement is a syntax construct. A function is an object. There's statements to create functions, like def:

    def Spam(): pass
    

    So statements are one of the ways to indicate to Python that you want it to create a function. Other than that, there's really not much relation between them.

提交回复
热议问题