I want to use the new positional only arguments syntax defined in PEP570, but I also want to maintain compatibility with python 3.7 (directly running the script with def f(a, /, b):
directly results in a syntax error). Is there anyway to do this?
If there isn't, for package maintainers, do they have to refrain from using the new feature until python 3.7 support is dropped?
Short answer: No, there is no way to do this.
I suppose technically you might be able to rig up a hack in your setup.py
to programmatically remove the positional-only syntax when installed on an older version of Python. But that's getting into extreme kludge territory; in practice, your choices are: