Are generator functions thread-safe?

Aahz aahz at pythoncraft.com
Mon Sep 16 11:25:09 EDT 2002


In article <T%dh9.6427$Lg2.1180859 at news2.news.adelphia.net>,
Robert Oschler <Oschler at earthlink.net> wrote:
>
>I know that a call to a generator function actually returns an independent
>iterator object (mea culpa if I'm wrong on this), but are there any hidden
>gotchas that would cause the use of the same generator function from
>multiple threads, to result in a sharing (especially local storage) or
>memory collision issue?

The same gotchas for any other function: you're screwed if you share
mutable objects without locks.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Project Vote Smart: http://www.vote-smart.org/



More information about the Python-list mailing list