In article <mailman.3048.1247462046.8015.python-l...@python.org>, Vincent Gulinao <vincent.guli...@gmail.com> 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 (a...@pythoncraft.com) <*> 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