Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It looks like it's a semi-internal(?) API notation for position-only fields.

That is, you cannot say sorted(iterable=range(10)) because 'iterable' is a position-only parameter.

Some pointers. https://www.python.org/dev/peps/pep-0436/

> / Establishes that all the proceeding arguments are positional-only. For now, Argument Clinic does not support functions with both positional-only and non-positional-only arguments. ... (The semantics of / follow a syntax for positional-only parameters in Python once proposed by Guido. [5] )

https://www.python.org/dev/peps/pep-0457/ ("PEP 457 -- Syntax For Positional-Only Parameters" - draft)

> All parameters before the / are positional-only. If / is not specified in a function signature, that function does not accept any positional-only parameters.

This is only for documenting API signatures. There is no way to implement directly in Python code. Eg, that PEP goes on to say:

> This PEP does not propose we implement positional-only parameters in Python. The goal of this PEP is simply to define the syntax, so that:

> - Documentation can clearly, unambiguously, and consistently express exactly how the arguments for a function will be interpreted.

> - The syntax is reserved for future use, in case the community decides someday to add positional-only parameters to the language.

See also https://bugs.python.org/issue21314 , "Add support for partial keyword arguments in extension functions"



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: