0

I have following pseudo-code:

global my_list = [1, 2, 3]
def thread1():
    my_list.append(10)
def thread2():
    my_list = my_list[1:]

Let's say thread2 is executing. Is it possible that it will be switched to thread1 in-between my_list slicing and assigning to my_list? What are operations that are never interrupted by context switch?

masb
  • 13
  • 1
  • 5

0 Answers0