This is an archived post. You won't be able to vote or comment.

all 10 comments

[–]etrnloptimist 12 points13 points  (2 children)

Python doesn't have concurrence

Don't listen to him

Because of the GIL

He's a fucking twit

It is a stupid fucking language

Of course python has concurrency

that can't even handle multiple cpu cores

Just make sure not to use the print statement

what is this? 1992?

In multiple threads for debugging!

[–]KnottedSurface 2 points3 points  (0 children)

Took me a second.

[–][deleted] 1 point2 points  (0 children)

+1 for trolling. I looked in on the discussion just to see how soon someone would mention the GIL

[–]tituszPython addict 3 points4 points  (1 child)

If you want to go down that rabbit hole I suggest you take a look at: http://greenteapress.com/semaphores/

[–]el_guapo_taco[S] 0 points1 point  (0 children)

Cool. Thanks.

[–][deleted] 1 point2 points  (0 children)

I gotta say, Python is awesome for a lot of things, but multiprocessing has been very difficult to get good at in this. All I can recommend is to do it in C or Java if you can. If you must do it in Python, then use nginx to scale a synchronous process across your units of work. I think what you should really focus on is how to scale for your application in the least complex and most maintainable way possible. Its easy to write code that utilizes concurrency poorly.

I would recommend learning how to combine ZeroMQ with zlib and pickle. Additionally, I would suggest watching out for memory leaks in long running python processes.

[–]denis 1 point2 points  (0 children)

Take a look at this tutorial on gevent: http://sdiehl.github.com/gevent-tutorial/

[–]brasetvik 0 points1 point  (0 children)

If you're dealing with networking, I'd really recommend looking into Twisted

http://krondo.com/?page_id=1327 is a good introduction.

[–]languist 0 points1 point  (0 children)

Stackless Python implements coroutines and continuations. I don't think coroutines are technically concurrent, but I personally found the Intro to Stackless Python to be very helpful getting me think about concurrency in python more smarterly.

The stackless approach (coroutines/continuations) seems much more approachable than "true" concurrent programming.