Hacker News new | past | comments | ask | show | jobs | submit login

Agree, I do it a lot as a way of selecting functions in a switch statement:

    handlers = {
        'dave'  : call_dave(),
        'ted'   : call_ted(),
        'julie' : contact('julie') }

    handlers['dave']()   # Call dave
    handlers['julie']()  # Contact julie

    [handlers[person]() for person in ['dave', 'julie', 'ted']] # Contact all three



Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: