allow 'name' in key word arguments of url_for() and url_path_for() (#608)#611
allow 'name' in key word arguments of url_for() and url_path_for() (#608)#611dansan wants to merge 8 commits intoKludex:masterfrom
Conversation
7b768d4 to
5f9575f
Compare
|
Were multiple commits, because I had forgotten coverage and black. I squashed them together, thus the force-push. |
lovelydinosaur
left a comment
There was a problem hiding this comment.
Lovely stuff - couple of minor changes suggested - otherwise looks ace!
fbc1e12 to
0ddea63
Compare
|
I reverted the |
|
Hi @blueyed , |
|
Bumping this PR since I am affected by this same problem and would love to see this land! |
|
I updated the code to be mergable to master. |
|
Great stuff. I'd probably prefer if we drop the |
|
I replaced the decorator with the asserts and the type check: f4f4cd1 |
|
Any possibility this is going to get merged? |
|
We still have this "bug". Would you mind rebasing it? I know 2.5 years is a lot... But would you mind rebasing it @dansan ? If not, I'd like to close the PR and creating an issue about this. |
499b19b to
6caeca9
Compare
|
@Kludex Sorry, had no time before the holidays to get into this. |
|
Is it bad to replace |
It means that anyone calling |
|
Can we deprecate the parameter "name"? Maybe warning when the caller uses "name=". See: import inspect
def potato(a: int, b: str) -> str:
print(inspect.stack()[-1].code_context)
return b
potato(1, b=2) |
This is a good solution to have before 1.0. |
Let's take a decision here. Options:
|
|
This PR may need to be considered in conjunction with #1385 . There are several solutions to solve these two problems at the same time:
|
|
I believe we prefer this one: |
|
Leading underscores are less discoverable. When you type What if we do like this |
|
The goal is to be less discoverable. 🤔 The idea is to move to |
|
I'm not sure if my last comment was that clear. The goal of having |
|
There is no difference between |
I see the goal here being exactly the opposite... Why would you want the IDE to show |
|
Is it possible to have a different signature depending on the Python version? Maybe we should already do this... |
I am aware that it could be an unexpected side effect when devs will update the project's python version. |
You mean this? import typing
if typing.TYPE_CHECKING:
def potato(__name: str, /) -> str:
"""Potato."""
return __name
else:
def potato(__name: str) -> str:
"""Potato."""
return __name
potato(__name="potato") # ERROR HEREIt's not possible due to syntax error. 😢 |
|
Anyone subscribed here is against the |
Patch replaces
with
(also for
url_for())Not entirely sure about the assertion text...
Without the above change, these existing (now modified) tests fail:
And this new one: