Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if and(): on line 39 of lambda_function.py #2

Open
fomightez opened this issue Jan 29, 2018 · 1 comment
Open

if and(): on line 39 of lambda_function.py #2

fomightez opened this issue Jan 29, 2018 · 1 comment

Comments

@fomightez
Copy link

During your stream I questioned the if and(): on line 39 of lambda_function.py? I have seen if all and if any used but not that.
Are you running vanilla Python 2 or Python 3? I ask because my tests in both flag that as a syntax error.

Here is the test code I put together from what I copied from your repo:

def validate_record(event):
    sn = str("Test").lower == TWITTER_SN
    media = "Testmedia"
    if and(
        TWITTER_SN.lower() in event.get('text', '').lower()
        sn,
        media
    ):
        return True
    return False

print (validate_record("Testing"))

I even tried versions where I distilled it down simpler and still I get a syntax error for each in both Python 3 and 2:

def validate_record():
    if and(None, None, None):
        return True
    return False

print (validate_record())

def validate_record():
    if and(0, 1, 1):
        return True
    return False

print (validate_record())

def validate_record():
    if and(True, False, True):
        return True
    return False

print (validate_record())
@ranman
Copy link
Owner

ranman commented Jan 29, 2018

yup that's my bad -- should be s/all/any()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants