Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: srinivas devaki Newsgroups: comp.lang.python Subject: Re: Continuing indentation Date: Sat, 5 Mar 2016 10:25:20 +0530 Lines: 100 Message-ID: References: <8760x4bo5h.fsf@elektro.pacujo.net> <871t7sbkex.fsf@elektro.pacujo.net> <87vb53se36.fsf@elektro.pacujo.net> <56d8d33d$0$1585$c3e8da3$5496439d@news.astraweb.com> <56D8DF99.6070808@lucidity.plus.com> <56d905a7$0$1605$c3e8da3$5496439d@news.astraweb.com> <56DA1ADF.2090109@lucidity.plus.com> <5d18634b-3c0f-48aa-a6b3-56fc9ce79d26@googlegroups.com> <20160304204927.4e801c71@bigbox.christie.dr> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de tAGuBNCOwiHnHsom6SGOJQkGnDXU+zd+mkFWcjy9hdcg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'received:209.85.223': 0.03; 'elif': 0.04; 'string.': 0.04; 'true,': 0.04; '"""': 0.05; 'diff': 0.05; 'none,': 0.05; 'false,': 0.07; 'string;': 0.07; 'cc:addr:python-list': 0.09; 'incorrect': 0.09; 'optional': 0.09; 'reached.': 0.09; 'stderr': 0.09; 'stdout': 0.09; 'terminate.': 0.09; 'to:addr:python.list': 0.09; 'to:addr:tim.thechases.com': 0.09; 'to:name:tim chase': 0.09; 'tuple': 0.09; 'python': 0.10; 'def': 0.13; '+91': 0.15; 'argument': 0.15; "'this": 0.16; '-tkc': 0.16; '2):': 0.16; '2016': 0.16; 'bytes),': 0.16; 'child.': 0.16; 'end-of-file': 0.16; 'hacked': 0.16; 'input:': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'self.stdin:': 0.16; 'self.stdout:': 0.16; 'threads': 0.16; 'unnecessary.': 0.16; 'useless': 0.16; 'wrote:': 0.16; 'byte': 0.18; 'bytes': 0.18; 'input': 0.18; 'student': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'junior': 0.22; 'am,': 0.23; 'sat,': 0.23; 'skip:l 40': 0.23; "haven't": 0.24; 'second': 0.24; 'tim': 0.24; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'chase': 0.29; 'raise': 0.29; 'print': 0.30; 'url:mailman': 0.30; 'code': 0.30; 'source': 0.33; 'url:python': 0.33; 'similar': 0.33; 'url:listinfo': 0.34; 'file': 0.34; 'add': 0.34; 'received:google.com': 0.35; 'could': 0.35; 'clear': 0.35; 'skip:* 20': 0.35; 'quite': 0.35; 'something': 0.35; 'but': 0.36; 'should': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'child': 0.36; 'indian': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'thought': 0.37; 'starting': 0.37; 'doing': 0.38; 'received:209': 0.38; 'someone': 0.38; 'or,': 0.38; 'data': 0.39; 'url:mail': 0.40; 'still': 0.40; 'school': 0.62; 'email addr:gmail.com': 0.62; 'mar': 0.65; 'benefit': 0.66; 'here': 0.66; 'results.': 0.67; '(3rd': 0.84; 'ph:': 0.84; 'worried': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=UW7h4f2MxLjk07vYhdt6uZ47/FGSjqwAVtvnJxVtKdg=; b=f6MwGzayxkE8mPWfi4SwvD9R+b4dWJWW7llKJSMUZpr2uzB6glfDzn6PKdE1ifye3E Zo89ZWVoJIiHiT1pe1GQgTf9wKJo2sRlp/Tsox67qlIfor7dVsqUNj4ANSnJkqQuBOT4 iN//nImCniaFQ0bkL0/KVAK3Hic7L6ri0TVTf8Vn10UiVXmjHLIlBGt0Kr/VgXd2OIKF lUWI1pl0iJpVcaU++FrM/DS0U+ltHJbdWFDOF3QhRZNiv93EbxHF5j/1fPeRYWfrqV7n teTRc0dSOnjhj+ffePMS5KPU0Pilmj0bJJKNRTAf6Nw91O9HnXOC7+pQpAJ7RYS3/cRG gxAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=UW7h4f2MxLjk07vYhdt6uZ47/FGSjqwAVtvnJxVtKdg=; b=TnLwGCPWuS9fAA/eqsXCv2axdoS1cpHjam4+/e9NnseppUnP90+CFaAXghoVQnObzp 0L8p80Qz6rRDWDcVpvgQAGoOylVucpXUj2JhxLus/TmMHEG7BbQeoyQyutlahXHAOpVw b14hp+mBdx+Y+1Gpt8txxB9XTNfjXwgsLQwEjrQy2VH0JCH9fIw/ByQEctKomjJyRmPE e+im4e/8gCjqWdNiHER/OFYDjxVwpGq8cZ/F1hGwitLQ+wM8GgaWLUOAHHSaSV6+zMeG 1kyM1E1+KAAUYpMTs3NHsOX1pIJIh3VSIYEBftZmpS472c1UCM/JqJo+Tqzyo7YSXxFN LH1Q== X-Gm-Message-State: AD7BkJKVYlqFXKD/mzpO80LWSJthkdPNMeHeUNOZdlhL5RD+g0e91UYFeKoFzCqLetKrNxAEGGujLf4Ut6qm0Q== X-Received: by 10.107.164.170 with SMTP id d42mr5274283ioj.80.1457153759955; Fri, 04 Mar 2016 20:55:59 -0800 (PST) In-Reply-To: <20160304204927.4e801c71@bigbox.christie.dr> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:104080 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: Send data to stdin. Read data from stdout and stderr, until end-of-file is reached. Wait for process to terminate. The optional "input" argument should be data to be sent to the child process (if self.universal_newlines is True, this should be a string; if it is False, "input" should be bytes), or None, if no data should be sent to the child. communicate() returns a tuple (stdout, stderr). These will be bytes or, if self.universal_newlines was True, a string. """ if self._communication_started and input: raise ValueError("Cannot send input after starting communication") # Optimization: If we are not worried about timeouts, we haven't # started communicating, and we have one or zero pipes, using select() # or threads is unnecessary. if (timeout is None and not self._communication_started and [self.stdin, self.stdout, self.stderr].count(None) >= 2): stdout = None stderr = None if self.stdin: self._stdin_write(input) elif self.stdout: stdout = self.stdout.read() self.stdout.close() elif self.stderr: stderr = self.stderr.read() [..... extra code snapped] ps: Python3.5.1 On Sat, Mar 5, 2016 at 8:19 AM, Tim Chase wrote: > On 2016-03-04 17:17, sohcahtoa82@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 changed. None of this > looking-deep-into-lines-to-see-what-changed. > > x \ > = \ > 5 > if \ > y \ > - != \ > + == \ > z: > print \ > 'this is terrible' > print \ > 'but still not incorrect > > Still terrible. But not quite as useless as a knee-jerk reaction > might suggest. > > I actually hacked together a binary-diff something like this, > emitting every hex-formatted byte of each file on its own line, then > diffing the two results. I could see doing something similar to diff > Python ASTs. > > -tkc > > > > > -- > https://mail.python.org/mailman/listinfo/python-list -- Regards Srinivas Devaki Junior (3rd yr) student at Indian School of Mines,(IIT Dhanbad) Computer Science and Engineering Department ph: +91 9491 383 249 telegram_id: @eightnoteight