*args vs **kwargs is unmanagable for future compatibility

Bug #1295881 reported by Jamie Lennox
6
This bug affects 1 person
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
Dolph Mathews (dolph)
Changed in python-keystoneclient:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-keystoneclient (master)

Reviewed: https://review.openstack.org/77026
Committed: https://git.openstack.org/cgit/openstack/python-keystoneclient/commit/?id=67e99991d52bc788a1380e8cb5fa1ffa27a484c8
Submitter: Jenkins
Branch: master

commit 67e99991d52bc788a1380e8cb5fa1ffa27a484c8
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
    Change-Id: Ic0a196874930e7be8362df50594471ab8037c5b2

Revision history for this message
Dolph Mathews (dolph) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/77055
Committed: https://git.openstack.org/cgit/openstack/python-keystoneclient/commit/?id=0788f53fa1c4fa20b73133f36c2cfa2c888ca7bf
Submitter: Jenkins
Branch: master

commit 0788f53fa1c4fa20b73133f36c2cfa2c888ca7bf
Author: Jamie Lennox <email address hidden>
Date: Fri Feb 28 13:31:00 2014 +1000

    Start using positional decorator

    Apply the positional decorator to functions. It has been added as I
    think best practice would dictate, though in some places it has been
    added in a way that doesn't break existing tests.

    Closes-Bug: #1295881
    Change-Id: I4f7ddbede4cba4ab79d144ad1f9dc83ea76f204a

Changed in python-keystoneclient:
status: In Progress → Fix Committed
Dolph Mathews (dolph)
Changed in python-keystoneclient:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.