Discuss / Python / 实在是看不懂逻辑。。

实在是看不懂逻辑。。

Topic source

JoyDamn

#1 Created at ... [Delete] [Delete and Lock User]

看了半个小时最后这个代码。。。虽然有两句注释,还是没看懂逻辑

def process_student():
    # 获取当前线程关联的student:
    std = local_school.student
    print('Hello, %s (in %s)' % (std, threading.current_thread().name))

def process_thread(name):
    # 绑定ThreadLocal的student:
    local_school.student = name
    process_student()

JoyDamn

#2 Created at ... [Delete] [Delete and Lock User]

又看了十分钟。。。终于理解一点了,哎,本科就应该学计算机的。这是太笨了


  • 1

Reply