Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.016 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; '(python': 0.07; 'subject:skip:t 10': 0.09; 'python': 0.11; 'def': 0.12; 'thread': 0.14; 'a.py': 0.16; 'b.py': 0.16; 'file1': 0.16; 'received:65.55.116.7': 0.16; 'run:': 0.16; 'true:': 0.16; 'advance.': 0.19; 'seems': 0.21; 'import': 0.22; 'received:65.55.116': 0.24; 'question': 0.24; 'code': 0.31; 'file:': 0.31; 'subject:About': 0.31; 'anyone': 0.31; 'but': 0.35; 'version:': 0.36; 'thank': 0.38; 'to:addr:python-list': 0.38; 'explain': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'skip:t 30': 0.61; 'new': 0.61; 'from:charset:utf-8': 0.61; 'here:': 0.62; 'skip:n 10': 0.64; 'regards.': 0.65 X-TMN: [t1KlJHX79jJYD07RMKvK/848i1RAAYP8] X-Originating-Email: [zhangpeipei812@outlook.com] From: =?UTF-8?B?5byg5L2p5L2p?= To: Subject: About threading.Thread Date: Sat, 5 Apr 2014 13:02:59 +0800 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 15.0 Thread-Index: Ac9QijvkOoTX4tqJSYK1sJJfOoCmcg== Content-Language: en-us X-OriginalArrivalTime: 05 Apr 2014 05:03:15.0194 (UTC) FILETIME=[59F585A0:01CF508C] X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1396674262 news.xs4all.nl 2835 [2001:888:2000:d::a6]:45352 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:69711 Hello guys: I have an question on threading.Thread My code is here: File1: a.py import threading import time def hello(): while True: print('hello') threads =3D threading.enumerate() for thread in threads: print(thread.getName()) time.sleep(3) def fun(): a =3D threading.Thread(target=3Dhello(), name=3D'hello') print("a file: I won't display!") a.start() File2: b.py import time from a import fun fun() print("b file: I won't display!") When I run: python b.py (python version: 2.7.6, 3.3.5, 3.4.0) It seems that threading.Thread() in file1 not create a new thread but = use MainThread. Anyone can explain this ? Thank you in advance. Best regards. peipei