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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 --089e0158c158e156d504f4688bf2 Content-Type: text/plain; charset=ISO-8859-1 Hi, I am using Thread class to create threads. thread = threading.Thread(target=Fun, args=[arg1, arg2, arg3="val"]) thread.start() 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 "", 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 Twitter --089e0158c158e156d504f4688bf2 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi,

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

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

<= /div>
In [20]: def Fun(agr1, arg2, arg3=3DNone):
=A0 =A0....:= =A0 =A0 pass
=A0 =A0....:=A0

In [21]: thread =3D threading= .Thread(target=3DFun, args=3D[arg1, arg2, arg3=3D&q= uot;val"])
------------------------------------------= ------------------
=A0 =A0File "<ipython console>", line 1
=A0 = =A0 =A0thread =3D threading.Thread(target=3DFun, args=3D[arg1, arg2, arg3= =3D"val"])
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0^
SyntaxError: invalid syntax

How do we p= ass the value to default arguments while creating thread object?
=
Regards,
~Piyush
--089e0158c158e156d504f4688bf2--