Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'programmer': 0.03; 'below).': 0.09; 'statements': 0.09; 'whichever': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'def': 0.12; '-tkc': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'happy.': 0.16; 'semicolon': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'import': 0.22; 'coding': 0.22; 'putting': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'developers': 0.25; '(see': 0.26; 'header:In-Reply-To:1': 0.27; "i'm": 0.30; 'subject:end': 0.31; 'skip:d 20': 0.34; '(2)': 0.35; 'really': 0.36; 'c++': 0.36; 'interact': 0.36; 'charset:us-ascii': 0.36; '(3)': 0.38; 'bad': 0.39; 'remove': 0.60; 'skip:u 10': 0.60; "you're": 0.61; 'between': 0.67; 'received:50.22': 0.84; 'yourself,': 0.95 Date: Wed, 28 Aug 2013 19:35:55 -0500 From: Tim Chase To: Mohsen Pahlevanzadeh Subject: Re: semicolon at end of python's statements In-Reply-To: <1377735506.18906.15.camel@debian> References: <1377735506.18906.15.camel@debian> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - boston.accountservergroup.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tim.thechases.com X-Get-Message-Sender-Via: boston.accountservergroup.com: none Cc: python-list@python.org 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: 56 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1377736483 news.xs4all.nl 15982 [2001:888:2000:d::a6]:52565 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:53199 On 2013-08-29 04:48, Mohsen Pahlevanzadeh wrote: > I'm C++ programmer and unfortunately put semicolon at end of my > statements in python. >=20 > Quesion: > What's really defferences between putting semicolon and don't put? =46rom a technical standpoint, nothing (see below). From a "readability on the part of other programmers" standpoint, it's bad practice. So if you're coding for yourself, do whichever makes you happy. If you want to interact with other Python developers and don't want to make them grumpy, remove them. -tkc >>> def with_semis(): ... print 1; ... print 2; ... print 3; ...=20 >>> def without_semis(): ... print 1 ... print 2 ... print 3 ...=20 >>> import dis >>> dis.dis(with_semis) 2 0 LOAD_CONST 1 (1) 3 PRINT_ITEM =20 4 PRINT_NEWLINE =20 3 5 LOAD_CONST 2 (2) 8 PRINT_ITEM =20 9 PRINT_NEWLINE =20 4 10 LOAD_CONST 3 (3) 13 PRINT_ITEM =20 14 PRINT_NEWLINE =20 15 LOAD_CONST 0 (None) 18 RETURN_VALUE =20 >>> dis.dis(without_semis) 2 0 LOAD_CONST 1 (1) 3 PRINT_ITEM =20 4 PRINT_NEWLINE =20 3 5 LOAD_CONST 2 (2) 8 PRINT_ITEM =20 9 PRINT_NEWLINE =20 4 10 LOAD_CONST 3 (3) 13 PRINT_ITEM =20 14 PRINT_NEWLINE =20 15 LOAD_CONST 0 (None) 18 RETURN_VALUE =20