Europython, threading and virtualenv Friday, July 23, 2010 I use threadscorrectly I do not use virtualenvand dont't want to Just needed to get that out of my system after europython, now mock me. PS: I should probably have done this as a lightening talk but that occurred to me too late. 6 comments: Steve Lacy said... +1 especially on virtualenv. I read all the docs, looked at the code, and decided that the whole thing exists so that you don't have to set PYTHONPATH. Oh, and lack of cross-platform (or even cross-machine for what it's worth) support is pretty much a deal breaker for virtualenv. Michael Foord said... Heh, virtualenv rocks. With you on the threads though. Floris Bruynooghe said... I can see in what situations virtualenv is useful, just don't need it (might have to do with me not doing any web development where some frameworks make life hard if you don't use it).And I should probably note that I also use multiprocessing/CSP, just find threads useful too. eric m said... I like virtualenv, but in keeping an open mind -could enlighten us to how you use threads correctly in lieu of virtualenv? casey said... Just curious, is your use of threads provably correct? ;^) Floris Bruynooghe said... @casey: Is any python code provably correct? :-P@eric m: I'm not sure I understand your "in lieu of virtualenv" part, so will ignore it. As to using threads correctly, just the usual stuff: Pass data in and out only via queues, databases or other such things. Avoid using instances in more then one thread and if you do (e.g. a .stop() on a thread), only let it interact via safe data (events, semaphores, conditions). Above all, keep it simple. If you need to think about the thread safety you're probably doing the wrong thing and may want to step back to look at your design a bit. New comments are not allowed.