Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.022 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'python,': 0.01; 'python': 0.08; '"hello': 0.09; 'backslash': 0.09; 'brackets': 0.09; 'of)': 0.09; 'antti': 0.16; 'brackets.': 0.16; 'received:10.2': 0.16; 'wrote:': 0.18; 'header:In-Reply-To:1': 0.22; 'command': 0.24; 'fine': 0.24; 'subject:data': 0.25; 'putting': 0.28; 'true,': 0.29; 'skip:b 20': 0.29; 'jean': 0.30; 'equivalent': 0.31; '---': 0.31; 'source': 0.32; 'certainly': 0.32; 'does': 0.32; 'there': 0.33; 'this.': 0.33; 'header:User-Agent:1': 0.33; 'rather': 0.34; 'to:addr:python-list': 0.35; 'subject:]': 0.36; 'received:org': 0.36; 'but': 0.37; 'open': 0.38; 'recommended': 0.39; 'subject:how': 0.39; 'to:addr:python.org': 0.40; 'content.': 0.71; 'continued': 0.80; '_required_': 0.84; 'so:': 0.84; 'subject:read': 0.84; 'subject:stream': 0.84; 'absolutely': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=modelnine.org; s=modelnine1012; t=1328623482; bh=N0xqhwuCHnoD+DVdG+y0LeTyfoMQdrTejWX9PlfLrb8=; h=Message-ID:Date:From:MIME-Version:To:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=g3Z8gkFEx6e/bQFDoTrk2Ct3WBx5g0U4zUf7eHk66ijHLqqGHU0nVqvq1iTNCMkqZ U6eCcPwawXC/EIqamMV2HpdzdnnuwL/yEJxgJNP0sbQiPE8TL0dJv5Qj65ZxhV/jRo at/oZ06T9XEYcwkCVDHqLJVq01BFJP1zv/8iKMLE= Date: Tue, 07 Feb 2012 15:04:39 +0100 From: Heiko Wundram User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120202 Thunderbird/11.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: how to read serial stream of data [newbie] References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 40 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1328623489 news.xs4all.nl 6988 [2001:888:2000:d::a6]:36424 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:19959 Am 07.02.2012 14:48, schrieb Antti J Ylikoski: > On 7.2.2012 14:13, Jean Dupont wrote: >> ser2 = serial.Serial(voltport, 2400, 8, serial.PARITY_NONE, 1, >> rtscts=0, dsrdtr=0, timeout=15) > > In Python, if you want to continue the source line into the next text > line, you must end the line to be continued with a backslash '\'. Absolutely not true, and this is bad advice (stylistically). When (any form of) brackets are open at the end of a line, Python does not start a new command on the next line but rather continues the backeted content. So: ser2 = serial.Serial(voltport, 2400, 8, serial.PARITY_NONE, 1, rtscts=0, dsrdtr=0, timeout=15) is perfectly fine and certainly the recommended way of putting this. Adding the backslash-continuation is always _possible_, but only _required_ when there are no open brackets. So: x = "hello" \ " test" is equivalent to: x = ("hello" " test") in assigning: x = "hello test" -- --- Heiko.