pyfunction: allow required positional after option #2093
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was testing out the current
main
on a large-ish project to see how easy upgrading would be, and also what the effect of the compile time improvements I've been making have been.Overall, it seems like since 0.15.1 the reduction in LLVM lines produced has indeed improved compile times a little; in a release build the optimizer spent about 10% less time on the project.
One thing I did notice was that upgrading to
main
was hard, purely because of the restriction on arguments introduced by #2041. The project in question has a lot of cases with arguments after anOption
, and they're all used correctly without panics.Therefore, this PR relaxes the restriction from #2041, and instead changes the behaviour such that if a positional required argument follows an
Option
, instead theOption
is also treated as required (user must explicitly passNone
or a value).This option-has-implicit-None-default is not well documented anywhere, and I'd like to write an issue about this at some point to consider formalizing design of this before we hit 1.0. Maybe some time after 0.16 is out.