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

Good point. Just a couple of points on futures: 1) they're backported to python 2[1], and 2) to make the example work, you need a pickleable function as you say, for example, if you have ipython running in a virtualenv:

    import pip
    pip.main(["install","futures"])

    import random

    def l(_):
        return random.random()

    with f.ProcessPoolExecutor(max_workers=4) as ex:
        out_list = list(ex.map(l, range(1000)))

    len(out_list)
    #> 1000
[1] https://pypi.python.org/pypi/futures



Whops, forgot to add a line to import futures:

    import futures as f #Include after pip.main(...




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

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

Search: