*args vs **kwargs is unmanagable for future compatibility
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-keystoneclient |
Fix Released
|
Medium
|
Jamie Lennox |
Bug Description
In python 2 there is no distinction between an optional argument and a keyword argument. This is generally not a problem but it means that arguments you expect to be passed as a keywork *could* be passed positionally and you are now stuck forever supporting the exact sequence of kwargs
This makes problems for if you want to ever add a positional argument in front of a bunch of keyword arguments or if you ever need to pass a bunch of kwargs through to a different function you must manually specify all those kwargs because removing them from the signature header is breaking compatibility.
We can promote good practice all we like but unless there is something programatically enforcing these rules we will always be stuck with this problem.
Changed in python-keystoneclient: | |
milestone: | none → 0.7.0 |
Changed in python-keystoneclient: | |
assignee: | nobody → Jamie Lennox (jamielennox) |
status: | New → In Progress |
Changed in python-keystoneclient: | |
importance: | Undecided → Medium |
Changed in python-keystoneclient: | |
status: | Fix Committed → Fix Released |
Reviewed: https:/ /review. openstack. org/77026 /git.openstack. org/cgit/ openstack/ python- keystoneclient/ commit/ ?id=67e99991d52 bc788a1380e8cb5 fa1ffa27a484c8
Committed: https:/
Submitter: Jenkins
Branch: master
commit 67e99991d52bc78 8a1380e8cb5fa1f fa27a484c8
Author: Jamie Lennox <email address hidden>
Date: Fri Feb 28 11:22:26 2014 +1000
Add a positional decorator
This decorator allow us to define that certain parameters are strictly
keyword arguments only, without sacrificing the convenience of having
those arguments listed in the function definition.
This will mean that we are no longer trapped maintaining backwards
compatibility for the order of keyword arguments.
The enforcement levels should allow us to start putting warnings on
existing functions and strict enforcement on new functions.
Partial-Bug: #1295881 be8362df5059447 1ab8037c5b2
Change-Id: Ic0a196874930e7