Skip to content

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

@fomightez

Description

@fomightez

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())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions