By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,957 Members | 1,969 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,957 IT Pros & Developers. It's quick & easy.

thread.start_new_thread question

P: n/a
Hi,

Just curious:
import thread
help(thread.start_new_thread)

. . .
start_new_thread(function, args[, kwargs])
. . .

Second argument is mandatory. Is it incidental or for a reason?

- kv
Jul 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi KV,

Here's a site that provides an easy, beginners example of how to do
threading. You might find this useful too... :-)

http://www.codesampler.com/python.htm
(Look for the "Spawning Threads" section.)

Brian
---
Konstantin Veretennicov wrote:
Hi,

Just curious:
import thread
help(thread.start_new_thread)


. . .
start_new_thread(function, args[, kwargs])
. . .

Second argument is mandatory. Is it incidental or for a reason?

- kv

Jul 19 '05 #2

P: n/a
On 6/17/05, Brian <de**********@netscape.com> wrote:
Hi KV,

Here's a site that provides an easy, beginners example of how to do
threading. You might find this useful too... :-)

http://www.codesampler.com/python.htm
(Look for the "Spawning Threads" section.)


Thank you, but that doesn't answer my question. I was asking if there
is a reason that "args" is not optional.

Oftentimes functions I use to start_new_thread have no arguments (they
may get data from bound instance or from closure), but still I have to
pass empty "args", always wondering, why? Python lib generally has a
very nice and convenient interface and tries to supply sensible
defaults when possible. That "args" is a required argument is a
mystery to me :)

- kv

A. No.
Q. Is top posting OK?
Jul 19 '05 #3

P: n/a
Konstantin Veretennicov wrote:
Thank you, but that doesn't answer my question. I was asking if there
is a reason that "args" is not optional.


At the risk of increasing your frustration, I'm going avoid answering
your question as well and simply point out that if you use the
"threading" module, as is recommended, you won't have to deal with this
issue at all, and your code will generally be simpler.

(To answer your real question I'd have to check the docs for "thread"
and, since I _never_ use that module in spite of heavy use of threading,
I can't help you more... sorry.)

-Peter
Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.