如何为用户在 python 中定义的函数实现“仅位置参数”?
def fun(a, b, /):
print(a**b)
fun(5,2) # 25
fun(a=5, b=2) # should show error
Run Code Online (Sandbox Code Playgroud) (base) C:\Users\Abj>python
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
(base) C:\Users\Abj>py
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
Run Code Online (Sandbox Code Playgroud)
这两条线之间有什么区别,MSC v.1900 64 位(AMD64)和 MSC v.1914 32 位(Intel)