GitHub user ryanm101 opened a pull request:

    https://github.com/apache/libcloud/pull/688

    Comment for why if XXX and YYY != XXX: is used

    Following attempt to clean up what looked to me like a redundant check I 
found out it wasn't in fact redundant but was providing support for partial 
lookups
    
    Per Greg Hill's explanation:
    The problem is name and service_type are optional parameters that default 
to None, if you look at the method signature. This lets you pass in only one of 
them, neither, or both, and it does the right thing in all cases.
    
    I've added a comment to make this clear to future contributes.
    
    For others reading this where it still isn't clear
    if XXX and YYY != XXX:
    does not translate to: (as was my initial thought) 
    if YYY != XXX:
    
    it actually translates to (we are checking if the Value is SET on the left 
side of the AND.
    if XXX:
    if YYY != XXX:

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ryanm101/libcloud trunk

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/libcloud/pull/688.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #688
    
----
commit eb6c56777b8645e689b0996eb5af9b489ea6cccc
Author: Ryan McLean <ryan1...@hotmail.com>
Date:   2016-01-26T08:21:23Z

    Added explination for 'if XXX and YYY != XXX:' (in a nut shell provides 
support for partial lookups)

commit 186c5b21850aab7ef5cc8670fd75013b1da8310c
Author: Ryan McLean <ryan1...@hotmail.com>
Date:   2016-01-28T10:28:40Z

    Merge remote-tracking branch 'upstream/trunk' into trunk

commit 3cfb5d30938c5b847f5564a47713a0c22970a533
Author: Ryan McLean <ryan1...@hotmail.com>
Date:   2016-01-28T10:35:09Z

    Removed trailing whitespace

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to