Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork942
Restore order of operators before executing the git command only for < py3.6#1193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Restore order of operators before executing the git command only for < py3.6#1193
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks a lot for your contribution, it's much appreciated!
Does that also mean that kwargs are now ordered by default? Or does it mean that the order won't change between calls even though the order is not as specified?
In the latter case, the result might still be considered unstable compared to ordering them.
What do you think?
Uh oh!
There was an error while loading.Please reload this page.
The PEP speaks aboutpreserving order, this should also mean, that the order wont changebetween calls. I cannot reproduce the example defpkwargs(**kwargs):print(kwargs)pkwargs(**{'one':1,'two':2,'three':3,'four':4}) This gives me one of these possible outputs:
For Python 3.6 it is stable and preserves the order:
|
9ba20a9
tob0422eb
CompareThe PEP link is also in the commit message:https://www.python.org/dev/peps/pep-0468/ |
Thanks a lot! Now this PR would be ready for merge even though I feel a little uncomfortable to remove support half a year after py3.5 reached its end of life given that it took 2 years to remove 3.4 support to be able to support inline types which has incredibly high value. My suggestion is to wait with the merge till Sept. 5, 2020 giving folks another half a year to stop using python 3.5 or face the potential for breakage. If you would like a merge right now one could add a python version check to keep the sort code for py3.5 maybe along a depreciation warning to let people know the date of removal. Thanks for sharing your thoughts. |
I don't think, shifting the date further back will have any effect. Most of us (the users) will drop py3.5, ony if we notice, that its not supported by the package we are using. But in the end, this is your call. I also do not have a problem, to make this conditionally on the python version in use, so stay tuned for an update, without the py3.5 drop. |
b0422eb
to52862a6
Compare52862a6
toa53bb10
Compare# only since 3.6 Python preserves the order of kwargs and thus has a stable | ||
# order. For older versions sort the kwargs by the key to get a stable | ||
# order. | ||
if sys.version_info[:2] < (3, 6): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
In order to make people aware, could you add a deprecation warning mentioning the date until this will work?
…< py3.6Since Python 3.6 kwargs order will be preserved and thus provide a stableorder, therefore we can make89ade7bconditional based on the Python. Thus make it able to pass ordered optionsto Git commands.See:https://www.python.org/dev/peps/pep-0468/
a53bb10
to5df76d4
CompareThanks a lot for your help! I will set a reminder for myself to remove python 3.5 support on September 5th. It would be super helpful to have a PR waiting which does that - the code was present here but seems to have been overwritten. |
Since Python 3.6 kwargs are stable ordered again and Python 3.5 reached
its end-of-life too, so we can revert89ade7b
again. Thus make it able to pass ordered options to Git commands again.