Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Jussi Piitulainen Newsgroups: comp.lang.python Subject: Re: Regular expressions Date: Tue, 03 Nov 2015 17:12:28 +0200 Organization: A noiseless patient Spider Lines: 15 Message-ID: References: <662g3blobme52hfoududj27err185v2npm@4ax.com> <20151102204237.6a78abdf@bigbox.christie.dr> <56382F33.8050905@gmail.com> <20151103055018.535e3e42@bigbox.christie.dr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="305c68510616a2e7ac08bcd2ff1598bd"; logging-data="982"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Yfobk3JAoOOTFdaj9IiVQECSRnWmqa4g=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:BkcosXaKqRSP0xlTWpWr/HQKxUw= sha1:2B65W4miRwRE1e/Df/kjc7FSnQI= Xref: csiph.com comp.lang.python:98163 Peter Otten writes: > If a "line" is defined as a string that ends with a newline > > def ends_in_asterisk(line): > return False > > would also satisfy the requirement. Lies, damned lies, and specs ;) Even if a "line" is defined as a string that comes from reading something like a file with default options, a line may end in an asterisk. >>> [ line.endswith('*') for line in StringIO('rivi*\nrivi*\nrivi*') ] [False, False, True]