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


Groups > comp.lang.python > #53236 > unrolled thread

Re: semicolon at end of python's statements

Started byAntoon Pardon <antoon.pardon@rece.vub.ac.be>
First post2013-08-29 12:11 +0200
Last post2013-08-29 12:11 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: semicolon at end of python's statements Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-08-29 12:11 +0200

#53236 — Re: semicolon at end of python's statements

FromAntoon Pardon <antoon.pardon@rece.vub.ac.be>
Date2013-08-29 12:11 +0200
SubjectRe: semicolon at end of python's statements
Message-ID<mailman.357.1377771103.19984.python-list@python.org>
Op 29-08-13 09:50, Gary Herron schreef:
> On 08/28/2013 07:10 PM, Sam Fourman Jr. wrote:
>>
>> On Wed, Aug 28, 2013 at 8:18 PM, Mohsen Pahlevanzadeh
>> <mohsen@pahlevanzadeh.org <mailto:mohsen@pahlevanzadeh.org>> wrote:
>>
>>     Dear all,
>>
>>     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?
>>
>>     Yours,
>>     Mohsen
>>
>>
>> I totally understand where you are coming from, but
>> I have found that the thing I can't get used to is the "indent thing"
>>
>> Python is a great language, but I always secretly find myself
>> wishing I could somehow use python, and not deal with the mandatory
>> "indents"
>>
>>
>> Sam Fourman Jr.
>>
> 
> What an odd thing to say.  In what sense do you consider indents to be
> non-mandatory in other languages?  In *any* programming language, if you
> write code without indents, it is absolutely unreadable, absolutely
> unmaintainable, and you will be absolutely fired!

Sure but the most readable indentation is not always the indentation
that follows the formal structure. Also IIRC it stopped the
introduction of a number of language features because the feature
didn't seem to fit pythons obligated indentation.

Without the forced indentation, one could introduce the feature and
have people experiment with what kind of indentation works best. Now
that wasn't an option.

> Other languages force you (and your editor) to maintain two indications
> of nesting, (1) indentation, so you can read it, and (2)
> braces/begin/end/whatever, so the compiler can read it.  Neither one is
> truly optional, and woe to you if the two don't match.  On the other
> hand, Python's use of indentation as the (only) indication of nesting is
> readable by both humans and parsers.

Sure but it means you lose redundancy and so sometimes that means it
is harder to find the problem. I remember the time that I somehow
ended up copying part of a function lower in the file. Now because
there was no need of a right brace or end or whatever this file
executed without a problem but redefined the function into an incomple
one. Should some kind of end marker be needed, the problem would have
been found much easier, because if would have produced a syntax error.

> Looked at that way, other languages seem foolish and burdensome and
> Python's indentation is the only sensible way.

I don't agree.

-- 
Antoon Pardon

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web