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?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <114piyush@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.010
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'syntax': 0.04; 'arguments': 0.09; 'subject:create': 0.09; 'subject:How': 0.10; 'def': 0.12; 'thread': 0.14; 'arg2,': 0.16; 'skip:a 80': 0.16; 'subject:default': 0.16; 'subject:object': 0.16; 'subject:pass': 0.16; 'syntaxerror:': 0.16; 'threads.': 0.16; 'import': 0.22; 'creating': 0.23; 'compilation': 0.24; 'pass': 0.26; '8bit%:3': 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; '"",': 0.31; 'file': 0.32; 'class': 0.32; 'received:google.com': 0.35; 'subject:?': 0.36; 'hi,': 0.36; 'skip:& 10': 0.38; '8bit%:4': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:- 60': 0.39; 'how': 0.40; 'skip:a 30': 0.61; 'skip:o 30': 0.61; 'facebook': 0.61; 'url:facebook': 0.67; 'invalid': 0.68; 'default': 0.69
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=lEFgrQFYw2k/JdD+witw7yf/BFkQYnWn8uanON2VYa8=; b=hYb4DkE55CBYFY8kH23a7I0XhehI1IFPB30zcsZtNd9yepHlY8d/oMU/wXyDugO774 u0d7Odb/zuIYzJ52Y4J9FKeTvWajsoBbiaA4jKMomeNUJSM5vtwkkn65pJRoPEFgxVKh aeMOzKufZENl1YdwK5SVkmi4cXNmtvEwhW2RP3JuhIMzT42ImsnGLo5RM0lOvZcTTwMF r2KPEauyH4QkmVd7jeA5mTLfqadhnZvMyIyytK4tck/f8Q0FQAnGJBUP66Mwe1DQkjjv 94b2W3XBlZhqOvveeh4b3LV+45unk78a1PrjY0HFQjODx/OKuF+WkbXleNfAGX6aGSzP 4Sug==
MIME-Version 1.0
X-Received by 10.152.29.8 with SMTP id f8mr1300930lah.11.1394629767418; Wed, 12 Mar 2014 06:09:27 -0700 (PDT)
Date Wed, 12 Mar 2014 18:39:27 +0530
Subject How do we pass default argument value to create thread object?
From Piyush Verma <114piyush@gmail.com>
To python-list@python.org
Content-Type multipart/alternative; boundary=089e0158c158e156d504f4688bf2
X-Mailman-Approved-At Wed, 12 Mar 2014 14:12:51 +0100
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.8088.1394629972.18130.python-list@python.org> (permalink)
Lines 64
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1394629972 news.xs4all.nl 2840 [2001:888:2000:d::a6]:45974
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:68278

Show key headers only | 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