Re: semicolon at end of python's statements

2018-04-03 Thread Tobiah
On 04/03/2018 09:48 AM, kar...@gmail.com wrote: Semicolon is optional. If you put a semicolon at the end of the of a statement, you can keep writing statements. a=3;b=2 PyCharm still complains about two statements on one line and sites Pep 8. I never used to pay much attention to Pep 8, but

Re: semicolon at end of python's statements

2018-04-03 Thread karuse
Semicolon is optional. If you put a semicolon at the end of the of a statement, you can keep writing statements. a=3;b=2 -- https://mail.python.org/mailman/listinfo/python-list

Re: semicolon at end of python's statements

2018-04-03 Thread Tobiah
On 04/01/2018 11:31 PM, dlt.joaq...@gmail.com wrote: El miércoles, 28 de agosto de 2013, 21:18:26 (UTC-3), Mohsen Pahlevanzadeh escribió: Dear all, I'm C++ programmer and unfortunately put semicolon at end of my statements in python. Quesion: What's really defferences between putting semico

Re: semicolon at end of python's statements

2018-04-01 Thread dlt . joaquin
El miércoles, 28 de agosto de 2013, 21:18:26 (UTC-3), Mohsen Pahlevanzadeh escribió: > 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 We

Re: semicolon at end of python's statements

2013-09-05 Thread Duncan Booth
Chris Angelico wrote: > On Fri, Sep 6, 2013 at 12:05 AM, Jeremy Sanders > wrote: >> Chris Angelico wrote: >> >>> Because s/he thought it made for better code, or as a joke? Usually I >>> see this sort of thing as the latter... It was intended for clearer code, which is true if you don't like cur

Re: semicolon at end of python's statements

2013-09-05 Thread Chris Angelico
On Fri, Sep 6, 2013 at 12:05 AM, Jeremy Sanders wrote: > Chris Angelico wrote: > >> Because s/he thought it made for better code, or as a joke? Usually I >> see this sort of thing as the latter... > > http://oldhome.schmorp.de/marc/bournegol.html > http://utcc.utoronto.ca/~cks/space/blog/programmi

Re: semicolon at end of python's statements

2013-09-05 Thread Grant Edwards
On 2013-09-05, Duncan Booth wrote: > Someone I knew actually used these definitions when writing C in a > Pascalish, Algol68ish style (if I remembered them correctly): > > #define IF if((( > #define AND ))&&(( > #define OR )||( > #define THEN ))){ > #define ELSE }else{ > #define FI } Yep, I once

Re: semicolon at end of python's statements

2013-09-05 Thread Jeremy Sanders
Chris Angelico wrote: > Because s/he thought it made for better code, or as a joke? Usually I > see this sort of thing as the latter... http://oldhome.schmorp.de/marc/bournegol.html http://utcc.utoronto.ca/~cks/space/blog/programming/BourneGol Jeremy -- https://mail.python.org/mailman/listinf

Re: semicolon at end of python's statements

2013-09-05 Thread Chris Angelico
On Thu, Sep 5, 2013 at 9:33 PM, Duncan Booth wrote: > Someone I knew actually used these definitions when writing C in a Pascalish, > Algol68ish > style (if I remembered them correctly): > > #define IF if((( > #define AND ))&&(( > #define OR )||( > #define THEN ))){ > #define ELSE }else{ > #defin

Re: semicolon at end of python's statements

2013-09-05 Thread Duncan Booth
Chris Angelico wrote: > On Thu, Aug 29, 2013 at 10:18 AM, Mohsen Pahlevanzadeh > 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? > > Very little

Re: semicolon at end of python's statements

2013-09-03 Thread Neil Cerutti
On 2013-09-03, Neil Cerutti wrote: > 3.2 and above provide contextlib.ExitStack, which I just now > learned about. > > with contextlib.ExitStack() as stack: > _in = stack.enter_context(open('some_file')) > _out = stack.enter_context(open('another_file', 'w')) > > It ain't beautiful, but it

Re: semicolon at end of python's statements

2013-09-03 Thread Neil Cerutti
On 2013-09-02, Roy Smith wrote: > In article , > "albert visser" wrote: > >> I like being able to do e.g. >> >> with open('some_file') as _in, open('another_file', 'w') as _out: > > It would be nice if you could write that as: > > with open('some_file'), open('another_file, 'w') as _

Re: semicolon at end of python's statements

2013-09-03 Thread Antoon Pardon
Op 03-09-13 01:17, Modulok schreef: > > So? Indeed there are too many people looking at these things as fighting > for the one true way. That is IMO part a big part of the problem. I have > no problem if someone else uses a different style than I do. Python as > a language tries t

Re: semicolon at end of python's statements

2013-09-02 Thread Modulok
> But, more than that, it saves the zillions of hours of > time wasted arguing about which way is better. > XD Nice. That's about the best supporting argument I've heard. -Modulok- -- http://mail.python.org/mailman/listinfo/python-list

Re: semicolon at end of python's statements

2013-09-02 Thread Roy Smith
In article , Modulok wrote: > > So? Indeed there are too many people looking at these things as fighting > > for the one true way. That is IMO part a big part of the problem. I have > > no problem if someone else uses a different style than I do. Python as > > a language tries too hard to enforc

Re: semicolon at end of python's statements

2013-09-02 Thread Modulok
> So? Indeed there are too many people looking at these things as fighting > for the one true way. That is IMO part a big part of the problem. I have > no problem if someone else uses a different style than I do. Python as > a language tries too hard to enforce a one true way. > > Try maintaining

Re: semicolon at end of python's statements

2013-09-02 Thread Chris Angelico
On Tue, Sep 3, 2013 at 3:58 AM, Tim Chase wrote: > On 2013-09-02 10:47, Roy Smith wrote: >> > > Perhaps he's worried about the world running out of tabs? >> > > >> > > I heard that most of the tab mines are in China and they're >> > > going to stop exporting... >> > >> > And buying all that indent

Re: semicolon at end of python's statements

2013-09-02 Thread Tim Chase
On 2013-09-02 10:47, Roy Smith wrote: > > > Perhaps he's worried about the world running out of tabs? > > > > > > I heard that most of the tab mines are in China and they're > > > going to stop exporting... > > > > And buying all that indentation supports terrorists. Conserve > > whitespace or t

Re: semicolon at end of python's statements

2013-09-02 Thread Roy Smith
In article , "albert visser" wrote: > I like being able to do e.g. > > with open('some_file') as _in, open('another_file', 'w') as _out: It would be nice if you could write that as: with open('some_file'), open('another_file, 'w') as _in, _out: -- http://mail.python.org/mailman/li

Re: semicolon at end of python's statements

2013-09-02 Thread albert visser
On Mon, 02 Sep 2013 12:58:23 +0200, Antoon Pardon wrote: Op 02-09-13 12:42, Fábio Santos schreef: On 09/02/2013 10:45 AM, Antoon Pardon wrote: Op 02-09-13 10:05, Steven D'Aprano schreef: [...] for item in seq: if cond: do_this() do_that() else: do_something else() which

Re: semicolon at end of python's statements

2013-09-02 Thread Steven D'Aprano
On Mon, 02 Sep 2013 20:14:40 +1000, Chris Angelico wrote: > On Mon, Sep 2, 2013 at 7:52 PM, Steven D'Aprano > wrote: >> Instead, we would have spent 100 times as much time and energy debating >> the One True Indentation Scheme, akin to the brace wars that went on >> for *years* in the C community

Re: semicolon at end of python's statements

2013-09-02 Thread Roy Smith
In article , Tim Chase wrote: > On 2013-09-02 14:20, Grant Edwards wrote: > > >> This saves an indent level. > > > > > > Just out of interest: is saving an indent level a useful thing? > > > > Perhaps he's worried about the world running out of tabs? > > > > I heard that most of the tab mines

Re: semicolon at end of python's statements

2013-09-02 Thread Tim Chase
On 2013-09-02 14:20, Grant Edwards wrote: > >> This saves an indent level. > > > > Just out of interest: is saving an indent level a useful thing? > > Perhaps he's worried about the world running out of tabs? > > I heard that most of the tab mines are in China and they're going to > stop exportin

Re: semicolon at end of python's statements

2013-09-02 Thread Grant Edwards
On 2013-08-31, Paul Rudin wrote: > Jussi Piitulainen writes: > > >> # Option 1.5 >> for spam in sequence: >> if not predicate(spam): continue >> process(spam) >> >> This saves an indent level. > > Just out of interest: is saving an indent level a useful thing? Perhaps he's worried about

Re: semicolon at end of python's statements

2013-09-02 Thread Antoon Pardon
Op 02-09-13 12:42, Fábio Santos schreef: > On 09/02/2013 10:45 AM, Antoon Pardon wrote: >> Op 02-09-13 10:05, Steven D'Aprano schreef: >>> It doesn't keep a whole chain of >>> if clauses together. It doesn't let you do anything that you haven't >>> already done. It just saves an indent and a newlin

Re: semicolon at end of python's statements

2013-09-02 Thread Antoon Pardon
Op 02-09-13 11:52, Steven D'Aprano schreef: > On Mon, 02 Sep 2013 10:29:05 +0200, Antoon Pardon wrote: > >> Why should we be more >> concerned with cascading ifs than with cascading controls in general? > > What cascading controls? > > for element in seq: > if filter: > > > > is n

Re: semicolon at end of python's statements

2013-09-02 Thread Fábio Santos
On 09/02/2013 10:45 AM, Antoon Pardon wrote: Op 02-09-13 10:05, Steven D'Aprano schreef: It doesn't keep a whole chain of if clauses together. It doesn't let you do anything that you haven't already done. It just saves an indent and a newline. The cost, on the other hand, includes the risk that

Re: semicolon at end of python's statements

2013-09-02 Thread Chris Angelico
On Mon, Sep 2, 2013 at 7:52 PM, Steven D'Aprano wrote: > Instead, we would have spent 100 times as much time and energy debating > the One True Indentation Scheme, akin to the brace wars that went on for > *years* in the C community. And still haven't completely gone. You mean like debating tabs

Re: semicolon at end of python's statements

2013-09-02 Thread Steven D'Aprano
On Mon, 02 Sep 2013 10:29:05 +0200, Antoon Pardon wrote: > Why should we be more > concerned with cascading ifs than with cascading controls in general? What cascading controls? for element in seq: if filter: is not a cascading control. [...] > All these discussions > about comb

Re: semicolon at end of python's statements

2013-09-02 Thread Antoon Pardon
Op 02-09-13 10:05, Steven D'Aprano schreef: > On Sun, 01 Sep 2013 21:58:15 +0200, Antoon Pardon wrote: > >> Op 31-08-13 02:09, Steven D'Aprano schreef: > >>> Adding a fourth option: >>> >>> for spam in sequence if predicate(spam): >>> process(spam) >>> >>> saves absolutely nothing except a l

Re: semicolon at end of python's statements

2013-09-02 Thread Antoon Pardon
Op 02-09-13 01:30, MRAB schreef: > On 01/09/2013 20:58, Antoon Pardon wrote: >> Op 31-08-13 02:09, Steven D'Aprano schreef: >>> On Fri, 30 Aug 2013 11:32:17 +0100, Fábio Santos wrote: >>> >> >>> >>> We really are spoiled for choice here. We can write any of these: >>> >>> # Option 1 >>> for spam in

Re: semicolon at end of python's statements

2013-09-02 Thread Steven D'Aprano
On Sun, 01 Sep 2013 21:58:15 +0200, Antoon Pardon wrote: > Op 31-08-13 02:09, Steven D'Aprano schreef: >> Adding a fourth option: >> >> for spam in sequence if predicate(spam): >> process(spam) >> >> saves absolutely nothing except a line and an indent level, neither of >> which are in short

Re: semicolon at end of python's statements

2013-09-01 Thread MRAB
On 01/09/2013 20:58, Antoon Pardon wrote: Op 31-08-13 02:09, Steven D'Aprano schreef: On Fri, 30 Aug 2013 11:32:17 +0100, Fábio Santos wrote: We really are spoiled for choice here. We can write any of these: # Option 1 for spam in sequence: if predicate(spam): process(spam)

Re: semicolon at end of python's statements

2013-09-01 Thread Antoon Pardon
Op 31-08-13 02:09, Steven D'Aprano schreef: On Fri, 30 Aug 2013 11:32:17 +0100, Fábio Santos wrote: We really are spoiled for choice here. We can write any of these: # Option 1 for spam in sequence: if predicate(spam): process(spam) Adding a fourth option: for spam in se

Re: semicolon at end of python's statements

2013-09-01 Thread Antoon Pardon
Op 31-08-13 02:09, Steven D'Aprano schreef: On Fri, 30 Aug 2013 11:32:17 +0100, Fábio Santos wrote: On 29 Aug 2013 23:20, "Ben Finney" wrote: Fábio Santos writes: It is a shame that this is not possible in python. for..if exists in comprehensions and not in regular loops but that would be

Re: semicolon at end of python's statements

2013-08-31 Thread Jussi Piitulainen
Paul Rudin writes: > Jussi Piitulainen writes: > > > # Option 1.5 > > for spam in sequence: > > if not predicate(spam): continue > > process(spam) > > > > This saves an indent level. > > Just out of interest: is saving an indent level a useful thing? It might be if process(spam) is a mor

Re: semicolon at end of python's statements

2013-08-31 Thread Paul Rudin
Jussi Piitulainen writes: > # Option 1.5 > for spam in sequence: > if not predicate(spam): continue > process(spam) > > This saves an indent level. Just out of interest: is saving an indent level a useful thing? I wouldn't lay out my code like that just because if you're coming back to

Re: semicolon at end of python's statements

2013-08-31 Thread Jussi Piitulainen
Steven D'Aprano writes: > We really are spoiled for choice here. We can write any of these: > > # Option 1 > for spam in sequence: > if predicate(spam): > process(spam) # Option 1.5 for spam in sequence: if not predicate(spam): continue process(spam) This saves an indent lev

Re: semicolon at end of python's statements

2013-08-30 Thread Terry Reedy
On 8/30/2013 8:09 PM, Steven D'Aprano wrote: We really are spoiled for choice here. We can write any of these: # Option 1 for spam in sequence: if predicate(spam): process(spam) # Option 2 for spam in filter(predicate, sequence): process(spam) # Option 3 for spam in (spam f

Re: semicolon at end of python's statements

2013-08-30 Thread Steven D'Aprano
On Fri, 30 Aug 2013 11:32:17 +0100, Fábio Santos wrote: > On 29 Aug 2013 23:20, "Ben Finney" wrote: >> >> Fábio Santos writes: >> >> > It is a shame that this is not possible in python. for..if exists in >> > comprehensions and not in regular loops but that would be nice >> > sometimes. >> >> So

Re: semicolon at end of python's statements

2013-08-30 Thread Chris Angelico
On Sat, Aug 31, 2013 at 12:14 AM, Antoon Pardon wrote: > Maybe python should just allow more than one control structure on one > line and then considers the end of the suite the end of both controls. > In that case we could just write the following: > > for a in lst: if a % 2: > treat a >

Re: semicolon at end of python's statements

2013-08-30 Thread Antoon Pardon
Op 30-08-13 12:53, Roy Smith schreef: > In article , > Fábio Santos wrote: > >> On 29 Aug 2013 23:20, "Ben Finney" wrote: >>> >>> Fábio Santos writes: >>> It is a shame that this is not possible in python. for..if exists in comprehensions and not in regular loops but that would be ni

Re: semicolon at end of python's statements

2013-08-30 Thread Roy Smith
In article , Fábio Santos wrote: > On 29 Aug 2013 23:20, "Ben Finney" wrote: > > > > Fábio Santos writes: > > > > > It is a shame that this is not possible in python. for..if exists in > > > comprehensions and not in regular loops but that would be nice > > > sometimes. > > > > So you use it i

Re: semicolon at end of python's statements

2013-08-30 Thread Fábio Santos
On 29 Aug 2013 23:20, "Ben Finney" wrote: > > Fábio Santos writes: > > > It is a shame that this is not possible in python. for..if exists in > > comprehensions and not in regular loops but that would be nice > > sometimes. > > So you use it in a generator expression, and iterate over the generat

Re: semicolon at end of python's statements

2013-08-30 Thread Antoon Pardon
Op 30-08-13 09:25, Chris Angelico schreef: > On Fri, Aug 30, 2013 at 5:15 PM, Antoon Pardon > wrote: >> Op 30-08-13 06:55, Ben Finney schreef: >>> Ben Finney writes: >>> Fábio Santos writes: > It is a shame that this is not possible in python. for..if exists in > comprehensions

Re: semicolon at end of python's statements

2013-08-30 Thread Chris Angelico
On Fri, Aug 30, 2013 at 5:15 PM, Antoon Pardon wrote: > Op 30-08-13 06:55, Ben Finney schreef: >> Ben Finney writes: >> >>> Fábio Santos writes: >>> It is a shame that this is not possible in python. for..if exists in comprehensions and not in regular loops but that would be nice

Re: semicolon at end of python's statements

2013-08-30 Thread Antoon Pardon
Op 30-08-13 06:55, Ben Finney schreef: > Ben Finney writes: > >> Fábio Santos writes: >> >>> It is a shame that this is not possible in python. for..if exists in >>> comprehensions and not in regular loops but that would be nice >>> sometimes. >> for foo in (spam for spam in sequence if pred

Re: semicolon at end of python's statements

2013-08-29 Thread Ben Finney
Ben Finney writes: > Fábio Santos writes: > > > It is a shame that this is not possible in python. for..if exists in > > comprehensions and not in regular loops but that would be nice > > sometimes. > for foo in (spam for spam in sequence if predicate(spam)): … Better: for foo in filte

Re: semicolon at end of python's statements

2013-08-29 Thread Chris Angelico
On Fri, Aug 30, 2013 at 8:17 AM, Ben Finney wrote: > Fábio Santos writes: > >> It is a shame that this is not possible in python. for..if exists in >> comprehensions and not in regular loops but that would be nice >> sometimes. > > So you use it in a generator expression, and iterate over the gen

Re: semicolon at end of python's statements

2013-08-29 Thread Ben Finney
Fábio Santos writes: > It is a shame that this is not possible in python. for..if exists in > comprehensions and not in regular loops but that would be nice > sometimes. So you use it in a generator expression, and iterate over the generator: for foo in (spam for spam in sequence if predica

Re: semicolon at end of python's statements

2013-08-29 Thread Antoon Pardon
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 >> mailto:moh...@pahlevanzadeh.org>> wrote: >> >> Dear all, >> >> I'm C++ programmer and unfortunately put semicolon at end of my >> state

Re: semicolon at end of python's statements

2013-08-29 Thread Fábio Santos
On 29 Aug 2013 10:54, "Chris Angelico" wrote: > > foreach (some_array, mixed val) if (some_condition) > { > //do something with val > } > I hope that you don't mind that I have started to use this in JavaScript back at work. Its foreach loop requires you to do a filter all the time. It is a

Re: semicolon at end of python's statements

2013-08-29 Thread Chris Angelico
On Thu, Aug 29, 2013 at 7:39 PM, Alister wrote: > Yet no doubt you voluntarily indent your c code to make it readable? > it wont take long before you find you don't even think about indentation > and actually like it Most of the time, in any language, I will indeed have indentation matching the s

Re: semicolon at end of python's statements

2013-08-29 Thread Alister
On Wed, 28 Aug 2013 22:10:16 -0400, Sam Fourman Jr. wrote: > On Wed, Aug 28, 2013 at 8:18 PM, Mohsen Pahlevanzadeh < > moh...@pahlevanzadeh.org> wrote: > >> Dear all, >> >> I'm C++ programmer and unfortunately put semicolon at end of my >> statements in python. >> >> Quesion: >> What's really def

Re: semicolon at end of python's statements

2013-08-29 Thread Gary Herron
On 08/28/2013 07:10 PM, Sam Fourman Jr. wrote: On Wed, Aug 28, 2013 at 8:18 PM, Mohsen Pahlevanzadeh mailto:moh...@pahlevanzadeh.org>> wrote: Dear all, I'm C++ programmer and unfortunately put semicolon at end of my statements in python. Quesion: What's really defference

Re: semicolon at end of python's statements

2013-08-29 Thread Sam Fourman Jr.
On Wed, Aug 28, 2013 at 8:18 PM, Mohsen Pahlevanzadeh < moh...@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

Re: semicolon at end of python's statements

2013-08-28 Thread Steven D'Aprano
On Thu, 29 Aug 2013 04:48:26 +0430, Mohsen Pahlevanzadeh 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? It's about the same as writing this: x = 1

Re: semicolon at end of python's statements

2013-08-28 Thread Roy Smith
In article , Chris Angelico wrote: > This is about Perl, but may be of interest. > > http://www.perl.com/pub/2007/12/06/soto-11.html I got about halfway through, then raised an uncaught TLDNR Exception. But I did like what he had to say about Tcl. Tcl is under-appreciated. A few gigs back,

Re: semicolon at end of python's statements

2013-08-28 Thread Chris Angelico
On Thu, Aug 29, 2013 at 10:33 AM, Roy Smith wrote: > In article , > Mohsen Pahlevanzadeh 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? > > I

Re: semicolon at end of python's statements

2013-08-28 Thread Chris Angelico
On Thu, Aug 29, 2013 at 10:37 AM, Tim Chase wrote: > On 2013-08-29 10:31, Chris Angelico wrote: >> but putting semicolons at the ends of Python statements is as >> useless as putting lots of (((irritating (((superfluous >> (((parentheses) in your C++ code. The parser won't mind, >>

Re: semicolon at end of python's statements

2013-08-28 Thread Ned Batchelder
On 8/28/13 8:18 PM, Mohsen Pahlevanzadeh 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? There is no difference. The semicolon is unnecessary in Python. If you i

Re: semicolon at end of python's statements

2013-08-28 Thread Roy Smith
In article , Mohsen Pahlevanzadeh 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? In theory, nothing. In practice, all the real Python programmers

Re: semicolon at end of python's statements

2013-08-28 Thread Tim Chase
On 2013-08-29 10:31, Chris Angelico wrote: > but putting semicolons at the ends of Python statements is as > useless as putting lots of (((irritating (((superfluous > (((parentheses) in your C++ code. The parser won't mind, > but subsequent programmers will wonder what these unneces

Re: semicolon at end of python's statements

2013-08-28 Thread Tim Chase
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 t

Re: semicolon at end of python's statements

2013-08-28 Thread Chris Angelico
On Thu, Aug 29, 2013 at 10:18 AM, Mohsen Pahlevanzadeh 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? Very little. Putting the semicolon makes you look