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


Groups > comp.lang.python > #53199

Re: semicolon at end of python's statements

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 <python.list@tim.thechases.com>
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 <python.list@tim.thechases.com>
To Mohsen Pahlevanzadeh <mohsen@pahlevanzadeh.org>
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 <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.334.1377736483.19984.python-list@python.org> (permalink)
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

Show key headers only | View raw


On 2013-08-29 04:48, Mohsen Pahlevanzadeh wrote:
> I'm C++ programmer and unfortunately put semicolon at end of my
> statements in python.
> 
> Quesion:
> What's really defferences between putting semicolon and don't put?

From 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;
... 
>>> def without_semis():
...     print 1
...     print 2
...     print 3
... 
>>> import dis
>>> dis.dis(with_semis)
  2           0 LOAD_CONST               1 (1)
              3 PRINT_ITEM          
              4 PRINT_NEWLINE       

  3           5 LOAD_CONST               2 (2)
              8 PRINT_ITEM          
              9 PRINT_NEWLINE       

  4          10 LOAD_CONST               3 (3)
             13 PRINT_ITEM          
             14 PRINT_NEWLINE       
             15 LOAD_CONST               0 (None)
             18 RETURN_VALUE        
>>> dis.dis(without_semis)
  2           0 LOAD_CONST               1 (1)
              3 PRINT_ITEM          
              4 PRINT_NEWLINE       

  3           5 LOAD_CONST               2 (2)
              8 PRINT_ITEM          
              9 PRINT_NEWLINE       

  4          10 LOAD_CONST               3 (3)
             13 PRINT_ITEM          
             14 PRINT_NEWLINE       
             15 LOAD_CONST               0 (None)
             18 RETURN_VALUE        

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


Thread

Re: semicolon at end of python's statements Tim Chase <python.list@tim.thechases.com> - 2013-08-28 19:35 -0500

csiph-web