New submission from 임수진학부생 <21600...@handong.edu>:

================================================================
import threading
import time

def threadFunc():
    while True:
        print('new thread')
        time.sleep(2)
def main():
    th = threading.Thread(target=threadFunc())
    th.start()
    while True:
       print('main Thread')
       time.sleep(1)
    th.join()
 
if __name__ == '__main__':
   main()
==============================================================

When I run the above code in python 3.7, it works in unexpected way.

I expected this code causes an syntax error for giving an improper argument to 
parameter because I gave "threaFunc()" not "threaFun" as an argument of target 
in Thread class. However, this code executes a function "threadFunc()" as a 
general function not thread.

----------
components: Windows
messages: 361622
nosy: paul.moore, steve.dower, tim.golden, zach.ware, 임수진학부생
priority: normal
severity: normal
status: open
title: Python Interpreter Doesn't Work Well In Thread Class
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39581>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to