In article <[email protected]>, Vincent Gulinao <[email protected]> wrote: > >lst = list() > >while True: > if len(lst) == SOME_NUMBER: > return lst > >Q2: operating on list from threads (mostly appends) must be safe, >right (synchronization)?
What do you mean by "safe"? Python certainly won't crash, but there's no guarantee that the list will be consistent from *your* perspective. Consider what happens if len(lst) == SOME_NUMBER - 1 and some other part of your code adds two elements to lst. You'll skip right over your if condition. -- Aahz ([email protected]) <*> http://www.pythoncraft.com/ "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." --Red Adair -- http://mail.python.org/mailman/listinfo/python-list
