Let's discuss something very interesting and useful improvement introduced in python3.8 (PEP 570), the position-only parameters, This is a function parameter syntax `/ ` to indicate that some function parameters must be specified positionally and cannot be used as keyword arguments.
In above function parameter are explained as:
pos1, pos2 - position-only parameters
/ - tells us that the parameters appearing before this sign are position-only.
pos_or_kw1, pos_or_kw2 - position-or-keyword parameters
* - tells us that the parameters appearing before this sign are of position-or-keyword type.
kw1, kw2 - keyword-only parameters
e.g. min(arg1, arg2)
Note: Do not use position-only parameters when parameter names have meaning and the function definition is more understandable by being explicit with names, go with keyword-only parameters instead.
e.g. namedtuple(typenames, field_names, …)
How to use position-only keywords:
different functions calls for `pow` would be like below style:
Outsource the best Development team now!
You know what a great tech team can do to your business. It is time to act fast and outsource the best one. But who to pick or choose? MarsDevs got your back!
We have a team of developers who can build, deploy, and manage applications for you so that you can focus on the business better. As soon as you register, our expertise becomes yours!