Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #68278

How do we pass default argument value to create thread object?

Date 2014-03-12 18:39 +0530
Subject How do we pass default argument value to create thread object?
From Piyush Verma <114piyush@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.8088.1394629972.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Hi,

I am using Thread class to create threads.
<CODE>
thread = threading.Thread(target=Fun, args=[arg1, arg2, arg3="val"])
thread.start()
</CODE>

This code is throwing compilation error(Ipython).
In [19]: import threading

In [20]: def Fun(agr1, arg2, arg3=None):
   ....:     pass
   ....:

In [21]: thread = threading.Thread(target=Fun, args=[arg1, arg2, arg3="val"
])
------------------------------------------------------------
   File "<ipython console>", line 1
     thread = threading.Thread(target=Fun, args=[arg1, arg2, arg3="val"])
                                                                 ^
SyntaxError: invalid syntax

How do we pass the value to default arguments while creating thread object?

Regards,
~Piyush
Facebook <https://www.facebook.com/piyushkv1>
Twitter<https://twitter.com/SocializePiyush>

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

How do we pass default argument value to create thread object? Piyush Verma <114piyush@gmail.com> - 2014-03-12 18:39 +0530

csiph-web