python 检查模块 positional_only 参数
python inspect module positional_only param
Value must be supplied as a positional argument.
Python has no explicit syntax for defining positional-only parameters,
but many built-in and extension module functions (especially those that
accept only one or two parameters) accept them.
有人可以给我一个 positional_only 论点的例子吗?
>>> print str.split.__doc__
S.split([sep [,maxsplit]]) -> list of strings
Return a list of the words in the string S, using sep as the
delimiter string. If maxsplit is given, at most maxsplit
splits are done. If sep is not specified or is None, any
whitespace string is a separator and empty strings are removed
from the result.
此处 str.split
有一个仅位置参数的示例:
>>> s = 'hello world'
>>> s.split(' ', maxsplit=1)
TypeError: split() takes no keyword arguments
>>> s.split(' ', 1)
['hello', 'world']
Value must be supplied as a positional argument.
Python has no explicit syntax for defining positional-only parameters, but many built-in and extension module functions (especially those that accept only one or two parameters) accept them.
有人可以给我一个 positional_only 论点的例子吗?
>>> print str.split.__doc__
S.split([sep [,maxsplit]]) -> list of strings
Return a list of the words in the string S, using sep as the
delimiter string. If maxsplit is given, at most maxsplit
splits are done. If sep is not specified or is None, any
whitespace string is a separator and empty strings are removed
from the result.
此处 str.split
有一个仅位置参数的示例:
>>> s = 'hello world'
>>> s.split(' ', maxsplit=1)
TypeError: split() takes no keyword arguments
>>> s.split(' ', 1)
['hello', 'world']