Python argument

1、函数定义

  • A positional argument is a name that is not followed by an equal assign(=) and default value.

        positional argument: ..., abc, ....

  • A keyword argument is followed by an equal sign(=) and an expression that gives its default value.

         keyword argument : tag='abc' 

https://docs.python.org/3/reference/compound_stmts.html#function

https://docs.python.org/3/glossary.html

2、函数调用(calls)

argument_list        ::=  positional_arguments ["," starred_and_keywords] ["," keywords_arguments]

                                   | starred_and_keywords ["," keywords_arguments]

                                   | keywords_arguments

https://docs.python.org/3/reference/expressions.html#grammar-token-positional-arguments

在函数调用时,位置参数(positional argument )在前,关键字参数(keyword argument)在后,因为python中函数在解析参数时, 是按照顺序来的, 位置参数是必须先满足, 才能考虑其他可变参数。

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值