Re: Continuing indentation

2016-03-05 Thread Steven D'Aprano
On Sat, 5 Mar 2016 08:14 am, sohcahto...@gmail.com wrote: > I wouldn't call PEP 8 "correct". I would say that you just simply agree > with PEP 8's suggestion. > > You guys are spending way too much time fighting over something that is > clearly subjective. Nobody is "correct" here. There's no

Re: Continuing indentation

2016-03-04 Thread Ben Finney
srinivas devaki writes: > thought i should add this here so that people will get to this after > someone decides a standard way to do this :P No, you've wasted that effort. If you want a request to be acted on by those who maintain the official Python source, submit it to the official Python bug

Re: Continuing indentation

2016-03-04 Thread srinivas devaki
thought i should add this here so that people will get to this after someone decides a standard way to do this :P look for second if condition in the source code of subprocess.Popen(*args, **kwargs).communicate def communicate(self, input=None, timeout=None): """Interact with process:

Re: Continuing indentation

2016-03-04 Thread Tim Chase
On 2016-03-04 17:17, sohcahto...@gmail.com wrote: > x \ > = \ > 5 > if \ > y \ > == \ > z: > print \ > 'this is terrible' > print \ > 'but still not incorrect > > It would be terrible, still but not incorrect. And has the sociopathic benefit that the diffs make it quite clear what

Re: Continuing indentation

2016-03-04 Thread Ben Finney
sohcahto...@gmail.com writes: > Arguing whether or not a style guide is "incorrect" is as silly as > arguing over whether lima beans are delicious. I think they're > disgusting, but you can't make a statement of fact about the topic. Yet there *are* many relevant facts that bear on the choice of

Re: Continuing indentation

2016-03-04 Thread Ethan Furman
On 03/04/2016 05:17 PM, sohcahto...@gmail.com wrote: I just can't understand why so many people get their panties all up in a bunch over how other people choose to format their code. s/panties/undies/g ;) -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Continuing indentation

2016-03-04 Thread Erik
Hi Ben, On 05/03/16 01:05, Ben Finney wrote: Certainly you are allowed. You should not expect that suggestion to be compelling unless it is accompanied by *factual*, rather than emotive, argument. I thought I had done that. I pointed out that LHS (whitespace) is significant when it comes to c

Re: Continuing indentation

2016-03-04 Thread sohcahtoa82
On Friday, March 4, 2016 at 4:43:57 PM UTC-8, Simon Ward wrote: > On 4 March 2016 23:31:43 GMT+00:00, Erik wrote: > >On 04/03/16 21:14, sohcahto...@gmail.com wrote: > >> You guys are spending way too much time fighting over something that > >is clearly subjective. Nobody is "correct" here. There

Re: Continuing indentation

2016-03-04 Thread Ben Finney
Erik writes: > On 05/03/16 00:23, Simon Ward wrote: > > Style guides are always going to be considered incorrect by some > > people, but they should aim more for consistency (the hobgoblin that > > may be), which is what makes code easier to grok. > > So you're saying that it doesn't matter if so

Re: Continuing indentation

2016-03-04 Thread Ethan Furman
On 03/04/2016 04:30 PM, Ben Finney wrote:> sohcahto...@gmail.com writes: >> On Friday, March 4, 2016 at 3:41:29 PM UTC-8, Ben Finney wrote: >>> We can't put the binary operator in multiple places, >> >> >> >> Who are you, the binary operator police? Watch me! >> >> if x == y and \ >> x

Re: Continuing indentation

2016-03-04 Thread Erik
On 05/03/16 00:23, Simon Ward wrote: Style guides are always going to be considered incorrect by some people, but they should aim more for consistency (the hobgoblin that may be), which is what makes code easier to grok. So you're saying that it doesn't matter if something is good or bad, as l

Re: Continuing indentation

2016-03-04 Thread Simon Ward
On 4 March 2016 23:31:43 GMT+00:00, Erik wrote: >On 04/03/16 21:14, sohcahto...@gmail.com wrote: >> You guys are spending way too much time fighting over something that >is clearly subjective. Nobody is "correct" here. There's no right and >wrong, just simple preference. > >I will take that as

Re: Continuing indentation

2016-03-04 Thread Ben Finney
sohcahto...@gmail.com writes: > On Friday, March 4, 2016 at 3:41:29 PM UTC-8, Ben Finney wrote: > > We can't put the binary operator in multiple places, > > > > Who are you, the binary operator police? Watch me! > > if x == y and \ > x == z and \ > a > b \ > or b > c \ >

Re: Continuing indentation

2016-03-04 Thread sohcahtoa82
On Friday, March 4, 2016 at 3:41:29 PM UTC-8, Ben Finney wrote: > alister writes: > > > On Fri, 04 Mar 2016 10:23:37 +0900, INADA Naoki wrote: > > > > > Because PEP8 says: > > > > > >> The preferred place to break around a binary operator is after the > > >> operator, not before it. http://pep8.

Re: Continuing indentation

2016-03-04 Thread Ethan Furman
On 03/04/2016 03:45 PM, Mark Lawrence wrote: > PEP8 is not a standard that must be adhered to under all > cicumstances, it is only a style guide [...] Not only that, it's a style guide for code /in the stdlib/. Make your own style guide for your own projects. ;) -- ~Ethan~ -- https://mail.pyt

Re: Continuing indentation

2016-03-04 Thread Mark Lawrence
On 04/03/2016 23:31, Erik wrote: On 04/03/16 21:14, sohcahto...@gmail.com wrote: You guys are spending way too much time fighting over something that is clearly subjective. Nobody is "correct" here. There's no right and wrong, just simple preference. I will take that as a vote +1 that PEP8 i

Re: Continuing indentation

2016-03-04 Thread Ben Finney
alister writes: > On Fri, 04 Mar 2016 10:23:37 +0900, INADA Naoki wrote: > > > Because PEP8 says: > > > >> The preferred place to break around a binary operator is after the > >> operator, not before it. http://pep8.org/#maximum-line-length > > and that is to make it obvious that there is more t

Re: Continuing indentation

2016-03-04 Thread Erik
On 04/03/16 21:14, sohcahto...@gmail.com wrote: You guys are spending way too much time fighting over something that is clearly subjective. Nobody is "correct" here. There's no right and wrong, just simple preference. I will take that as a vote +1 that PEP8 is wrong (*). ;) E. (*) PEP8 de

Re: Continuing indentation

2016-03-04 Thread Mark Lawrence
On 04/03/2016 21:14, sohcahto...@gmail.com wrote: On Friday, March 4, 2016 at 6:03:48 AM UTC-8, alister wrote: On Fri, 04 Mar 2016 10:12:58 +, cl wrote: Steven D'Aprano wrote: On Fri, 4 Mar 2016 12:23 pm, INADA Naoki wrote: Indeed. I don't understand why, when splitting a condition s

Re: Continuing indentation

2016-03-04 Thread sohcahtoa82
On Friday, March 4, 2016 at 6:03:48 AM UTC-8, alister wrote: > On Fri, 04 Mar 2016 10:12:58 +, cl wrote: > > > Steven D'Aprano wrote: > >> On Fri, 4 Mar 2016 12:23 pm, INADA Naoki wrote: > >> > >> > >> >> > >> >> Indeed. I don't understand why, when splitting a condition such as > >> >> thi

Re: Continuing indentation

2016-03-04 Thread Ethan Furman
On 03/04/2016 07:25 AM, Ian Kelly wrote: On Fri, Mar 4, 2016 at 7:03 AM, alister wrote: On Fri, 04 Mar 2016 10:12:58 +, cl wrote: Steven D'Aprano wrote: On Fri, 4 Mar 2016 12:23 pm, INADA Naoki wrote: Indeed. I don't understand why, when splitting a condition such as this, people te

Re: Continuing indentation

2016-03-04 Thread Ian Kelly
On Fri, Mar 4, 2016 at 7:03 AM, alister wrote: > On Fri, 04 Mar 2016 10:12:58 +, cl wrote: > >> Steven D'Aprano wrote: >>> On Fri, 4 Mar 2016 12:23 pm, INADA Naoki wrote: >>> >>> >>> >> >>> >> Indeed. I don't understand why, when splitting a condition such as >>> >> this, >>> >> people tend t

Re: Continuing indentation

2016-03-04 Thread alister
On Fri, 04 Mar 2016 10:12:58 +, cl wrote: > Steven D'Aprano wrote: >> On Fri, 4 Mar 2016 12:23 pm, INADA Naoki wrote: >> >> >> >> >> >> Indeed. I don't understand why, when splitting a condition such as >> >> this, >> >> people tend to put the operator at the end of each line. >> >> >> >> >

Re: Continuing indentation

2016-03-04 Thread alister
On Fri, 04 Mar 2016 10:23:37 +0900, INADA Naoki wrote: >> >> Indeed. I don't understand why, when splitting a condition such as >> this, >> people tend to put the operator at the end of each line. >> >> > Because PEP8 says: > >> The preferred place to break around a binary operator is after the

Re: Continuing indentation

2016-03-04 Thread cl
Steven D'Aprano wrote: > On Fri, 4 Mar 2016 12:23 pm, INADA Naoki wrote: > > >> > >> > >> Indeed. I don't understand why, when splitting a condition such as this, > >> people tend to put the operator at the end of each line. > >> > >> > > Because PEP8 says: > > > >> The preferred place to break

Re: Continuing indentation

2016-03-03 Thread Marko Rauhamaa
Steven D'Aprano : > class C: > def method(self): > if (result is None > or self.some_condition() > or len(some_sequence) > 100 > or some_other_condition > or page_count < 5 > ): > do_processing() >

Re: Continuing indentation

2016-03-03 Thread Steven D'Aprano
On Fri, 4 Mar 2016 12:23 pm, INADA Naoki wrote: >> >> >> Indeed. I don't understand why, when splitting a condition such as this, >> people tend to put the operator at the end of each line. >> >> > Because PEP8 says: > >> The preferred place to break around a binary operator is after the > operat

Re: Continuing indentation

2016-03-03 Thread Erik
On 04/03/16 01:23, INADA Naoki wrote: Indeed. I don't understand why, when splitting a condition such as this, people tend to put the operator at the end of each line. Because PEP8 says: The preferred place to break around a binary operator is after the operator, not before it. I mean in

Re: Continuing indentation

2016-03-03 Thread INADA Naoki
> > > Indeed. I don't understand why, when splitting a condition such as this, > people tend to put the operator at the end of each line. > > Because PEP8 says: > The preferred place to break around a binary operator is after the operator, not before it. http://pep8.org/#maximum-line-length -- ht

Re: Continuing indentation

2016-03-03 Thread Erik
On 04/03/16 00:13, Steven D'Aprano wrote: class C: def method(self): if (result is None or self.some_condition() or len(some_sequence) > 100 or some_other_condition or page_count < 5 ): do_

Re: Continuing indentation

2016-03-03 Thread INADA Naoki
> > > class C: > def method(self): > if (result is None > or self.some_condition() > or len(some_sequence) > 100 > or some_other_condition > or page_count < 5 > ): > do_processing() > > > Looks fine

Re: Continuing indentation

2016-03-03 Thread Steven D'Aprano
On Fri, 4 Mar 2016 03:47 am, Marko Rauhamaa wrote: > John Gordon : > >> In <871t7sbkex@elektro.pacujo.net> Marko Rauhamaa >> writes: >> >>> Ethan Furman : >> >>> > No, it isn't. Using '\' for line continuation is strongly >>> > discouraged. >> >>> Why would you discourage valid syntax? >> >

Re: Continuing indentation

2016-03-03 Thread Marko Rauhamaa
Rob Gaddi : > Not ugly, error-prone. The first is purely aestehetic, the second > actually matters. Let something as simple as a trailing space sneak in > after your backslash and your meaning changes. Blank line between; > same thing. Never been bitten by that. Now, trying how emacs' indentatio

Re: Continuing indentation

2016-03-03 Thread Rob Gaddi
Marko Rauhamaa wrote: > John Gordon : > >> In <871t7sbkex@elektro.pacujo.net> Marko Rauhamaa >> writes: >> >>> Ethan Furman : >> >>> > No, it isn't. Using '\' for line continuation is strongly discouraged. >> >>> Why would you discourage valid syntax? >> >> Some things that are permissible m

Re: Continuing indentation

2016-03-03 Thread Marko Rauhamaa
John Gordon : > In <871t7sbkex@elektro.pacujo.net> Marko Rauhamaa > writes: > >> Ethan Furman : > >> > No, it isn't. Using '\' for line continuation is strongly discouraged. > >> Why would you discourage valid syntax? > > Some things that are permissible may not be desirable. Line continuat

Re: Continuing indentation

2016-03-03 Thread John Gordon
In <871t7sbkex@elektro.pacujo.net> Marko Rauhamaa writes: > Ethan Furman : > > No, it isn't. Using '\' for line continuation is strongly discouraged. > Why would you discourage valid syntax? Some things that are permissible may not be desirable. -- John Gordon A is for

Re: Continuing indentation

2016-03-03 Thread cl
codewiz...@gmail.com wrote: > On Wednesday, March 2, 2016 at 3:44:07 PM UTC-5, Skip Montanaro wrote: > > > > if (some_condition and > > some_other_condition and > > some_final_condition): > > play_bingo() > > How about: > > continue_playing = ( > some_conditio

Re: Continuing indentation

2016-03-02 Thread Tim Chase
On 2016-03-03 08:29, Ben Finney wrote: > Skip Montanaro writes: >> Running flake8 over some code which has if statements with >> multiple conditions like this: >> >> if (some_condition and >> some_other_condition and >> some_final_condition): >> play_bingo() > > For th

Re: Continuing indentation

2016-03-02 Thread Ethan Furman
On 03/02/2016 06:33 PM, Chris Angelico wrote: It's not just name collisions. You should be able to keep in your head every local name in a section of code. Giving a name to a single-use expression wastes one of those precious slots in your mind, even if it's easily and safely unique. If it's a

Re: Continuing indentation

2016-03-02 Thread Chris Angelico
On Thu, Mar 3, 2016 at 1:30 PM, Ben Finney wrote: > If your functions are so long that you fear using a specific name will > deter you from using it again *in the same scope*, then the name isn't > descriptive and a better one should be chosen, or the function is too > large and should be broken i

Re: Continuing indentation

2016-03-02 Thread Ben Finney
Steven D'Aprano writes: > If you only use "continue_playing" in exactly one place, then it > doesn't deserve a name. I disagree. If it's complex, then it may still deserve a name. > > Names are important! > > Too important to waste on every single-use expression. To waste on *every* single-use

Re: Continuing indentation

2016-03-02 Thread Steven D'Aprano
On Thu, 3 Mar 2016 11:02 am, Carl Meyer wrote: > On 03/02/2016 04:54 PM, Chris Angelico wrote: >> On Thu, Mar 3, 2016 at 10:46 AM, wrote: >>> On Wednesday, March 2, 2016 at 3:44:07 PM UTC-5, Skip Montanaro wrote: if (some_condition and some_other_condition and

Re: Continuing indentation

2016-03-02 Thread Steven D'Aprano
On Thu, 3 Mar 2016 09:10 am, Marko Rauhamaa wrote: > Ethan Furman : > >> No, it isn't. Using '\' for line continuation is strongly discouraged. > > Why would you discourage valid syntax? Because it is error-prone and ugly. This is valid syntax too. Do you write your code like this? x

Re: Continuing indentation

2016-03-02 Thread Ben Finney
(Igor, your “From” field doesn't contain a name for you. Can you put your name, e.g. “Igor Whateverisyoursurname”, in the “From” field?) codewiz...@gmail.com writes: > How about: > > continue_playing = ( > some_condition and > some_other_condition and > some_final_condition >

Re: Continuing indentation

2016-03-02 Thread Pete Forman
Chris Angelico writes: > On Thu, Mar 3, 2016 at 10:46 AM, wrote: >> On Wednesday, March 2, 2016 at 3:44:07 PM UTC-5, Skip Montanaro wrote: >>> >>> if (some_condition and >>> some_other_condition and >>> some_final_condition): >>> play_bingo() >> >> How about: >> >>

Re: Continuing indentation

2016-03-02 Thread Carl Meyer
On 03/02/2016 04:54 PM, Chris Angelico wrote: > On Thu, Mar 3, 2016 at 10:46 AM, wrote: >> On Wednesday, March 2, 2016 at 3:44:07 PM UTC-5, Skip Montanaro wrote: >>> >>> if (some_condition and >>> some_other_condition and >>> some_final_condition): >>> play_bingo() >>

Re: Continuing indentation

2016-03-02 Thread Chris Angelico
On Thu, Mar 3, 2016 at 10:46 AM, wrote: > On Wednesday, March 2, 2016 at 3:44:07 PM UTC-5, Skip Montanaro wrote: >> >> if (some_condition and >> some_other_condition and >> some_final_condition): >> play_bingo() > > How about: > > continue_playing = ( > some_co

Re: Continuing indentation

2016-03-02 Thread codewizard
On Wednesday, March 2, 2016 at 3:44:07 PM UTC-5, Skip Montanaro wrote: > > if (some_condition and > some_other_condition and > some_final_condition): > play_bingo() How about: continue_playing = ( some_condition and some_other_condition and some_fi

Re: Continuing indentation

2016-03-02 Thread Chris Angelico
On Thu, Mar 3, 2016 at 9:10 AM, Marko Rauhamaa wrote: > Ethan Furman : > >> No, it isn't. Using '\' for line continuation is strongly discouraged. > > Why would you discourage valid syntax? > Isn't that exactly the point of style guides? They stipulate/encourage a particular subset of valid synt

Re: Continuing indentation

2016-03-02 Thread Ethan Furman
On 03/02/2016 02:44 PM, Skip Montanaro wrote: I don't know. Maybe I need to ask the flake8 author about his rationale for this message. It seems to me from my experience with the language that this particular message is going against pretty common practice. Does vim's Python mode exhibit similar

Re: Continuing indentation

2016-03-02 Thread Ethan Furman
On 03/02/2016 02:10 PM, Marko Rauhamaa wrote: Ethan Furman : No, it isn't. Using '\' for line continuation is strongly discouraged. Why would you discourage valid syntax? 1) It's ugly 2) Any non-newline whitespace after the '\' and you don't have line continuation any more, and no visib

Re: Continuing indentation

2016-03-02 Thread Skip Montanaro
Thanks for the replies, folks. I'll provide a single response: 1. Using backslash to continue... When I first started using Python in the mid-90s I don't recall that parenthesized expressions could be continued across lines (at least, not in all contexts), so the backslash was required. I believe

Re: Continuing indentation

2016-03-02 Thread Marko Rauhamaa
Ethan Furman : > No, it isn't. Using '\' for line continuation is strongly discouraged. Why would you discourage valid syntax? Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: Continuing indentation

2016-03-02 Thread Ethan Furman
On 03/02/2016 12:50 PM, Marko Rauhamaa wrote: Skip Montanaro queried: Running flake8 over some code which has if statements with multiple conditions like this: if (some_condition and some_other_condition and some_final_condition): play_bingo() [...] is there a

Re: Continuing indentation

2016-03-02 Thread Ben Finney
Skip Montanaro writes: > Running flake8 over some code which has if statements with multiple > conditions like this: > > if (some_condition and > some_other_condition and > some_final_condition): > play_bingo() > > the tool complains that the indentation of the conditi

Re: Continuing indentation

2016-03-02 Thread Peter Otten
Skip Montanaro wrote: > Running flake8 over some code which has if statements with multiple > conditions like this: > > if (some_condition and > some_other_condition and > some_final_condition): > play_bingo() > > the tool complains that the indentation of the conditi

Re: Continuing indentation

2016-03-02 Thread Wolfgang Maier
On 3/2/2016 21:43, Skip Montanaro wrote: Running flake8 over some code which has if statements with multiple conditions like this: if (some_condition and some_other_condition and some_final_condition): play_bingo() the tool complains that the indentation of the c

Re: Continuing indentation

2016-03-02 Thread Marko Rauhamaa
Skip Montanaro : > Running flake8 over some code which has if statements with multiple > conditions like this: > > if (some_condition and > some_other_condition and > some_final_condition): > play_bingo() > [...] > > is there a better way to break lines I'm missing whic

Continuing indentation

2016-03-02 Thread Skip Montanaro
Running flake8 over some code which has if statements with multiple conditions like this: if (some_condition and some_other_condition and some_final_condition): play_bingo() the tool complains that the indentation of the conditions is the same as the next block. In th