Positional-only arguments in Python - DeepSource

Get started For teams Documentation Login Get started For teams Documentation Login Insights Python By Sanket on August 21, 2019 The ability to specify positional-only arguments using the / marker in function definitions is among the many new improvements to the Python language coming in the upcoming 3.8 release . This addition to syntax has performance benefits and enables better API design. Let's look at the motivation behind positional-only arguments and how to use it, with examples. Keyword-only arguments have been available in Python with the * marker, and addition of / marker for positional-only arguments improves the language’s consistency. With positional-or-keyword parameters, the mix of calling conventions is not always desirable. Consider these examples: Some function parameters already have semantic meaning: name...

Linked on 2019-08-29 17:58:47 | Similar Links