GitHub user ryanm101 opened a pull request:
https://github.com/apache/libcloud/pull/685
Added explination for 'if XXX and YYY != XXX:'
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/685.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 #685
----
commit eb6c56777b8645e689b0996eb5af9b489ea6cccc
Author: Ryan McLean <[email protected]>
Date: 2016-01-26T08:21:23Z
Added explination for 'if XXX and YYY != XXX:' (in a nut shell provides
support for partial lookups)
----
---
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 [email protected] or file a JIRA ticket
with INFRA.
---