Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'warnings': 0.03; 'interpreter': 0.04; 'say,': 0.05; 'option,': 0.07; 'python': 0.09; 'pep': 0.09; 'tab': 0.09; 'cc:addr:python-list': 0.10; 'thread': 0.11; ':-)': 0.13; '"code': 0.16; '-tt': 0.16; 'differs': 0.16; 'filename:fname piece:signature': 0.16; 'indent': 0.16; 'invoking': 0.16; 'mixture': 0.16; 'subject:fails': 0.16; 'subject:when': 0.16; 'tabs': 0.16; 'wrote:': 0.17; 'projects,': 0.17; '(in': 0.18; 'do.': 0.21; 'error.': 0.21; 'converted': 0.22; 'default,': 0.22; 'cc:2**0': 0.23; 'second': 0.24; 'command': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'errors.': 0.27; 'mix': 0.27; 'strongly': 0.27; 'options': 0.27; 'subject:/': 0.28; 'complain': 0.29; 'context,': 0.29; 'editors': 0.29; 'quoting': 0.29; 'spaces': 0.29; 'probably': 0.29; "i'm": 0.29; 'code': 0.31; 'could': 0.32; 'strict': 0.33; 'recommended': 0.33; 'another': 0.33; "can't": 0.34; 'third': 0.34; 'pm,': 0.35; 'really': 0.36; 'subject:': 0.36; 'but': 0.36; 'test': 0.36; 'should': 0.36; 'bad': 0.37; 'level': 0.37; 'subject:: ': 0.38; 'think': 0.40; 'easy': 0.60; 'most': 0.61; 'first': 0.61; 'more': 0.63; 'become': 0.65; 'fact,': 0.69; '01:57': 0.84; 'fourth': 0.84; 'subject:else': 0.84; '"it': 0.91 Date: Wed, 28 Nov 2012 14:08:15 -0600 From: Evan Driscoll User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.10) Gecko/20121026 Thunderbird/10.0.10 MIME-Version: 1.0 To: Ian Kelly Subject: Re: Re: re.search when used within an if/else fails References: <50aadbe6$0$29983$c3e8da3$5496439d@news.astraweb.com> <50aadcf0$0$29983$c3e8da3$5496439d@news.astraweb.com> <2930dc36-9d8f-411d-aa7a-272fe4885ec5@i5g2000yqh.googlegroups.com> <11835b30-3448-45cc-9ae5-46d651f93429@googlegroups.com> In-Reply-To: X-Enigmail-Version: 1.4 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig2051CA9AE17E00279A4BB18C" Cc: Python X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 67 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1354133357 news.xs4all.nl 6988 [2001:888:2000:d::a6]:59083 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:34032 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig2051CA9AE17E00279A4BB18C Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 11/28/2012 01:57 PM, Ian Kelly wrote: > Yes, it's best to use either tabs-only or spaces-only. Quoting from PE= P > 8 on the subject: >=20 > Never mix tabs and spaces. >=20 > The most popular way of indenting Python is with spaces only. The > second-most popular way is with tabs only. Code indented with a > mixture of tabs and spaces should be converted to using spaces > exclusively. When invoking the Python command line interpreter with= > the -t option, it issues warnings about code that illegally mixes > tabs and spaces. When using -tt these warnings become errors. These= > options are highly recommended! >=20 > For new projects, spaces-only are strongly recommended over tabs. > Most editors have features that make this easy to do. >=20 >=20 > I thought the prohibition against mixing tabs and spaces was made more > strict in Python 3, but I can't find any reference to that now.=20 > Probably I was mistaken. I'm only entering this thread now so I'm not really in context, but you're correct; in Python 3, -tt is set by default, which makes illegal mixing an error. However, not all mixing is illegal: what it means by "code that illegally mixes tabs and spaces" is "code whose interpretation differs depending upon the interpretation of the tab width". While I'm not going to go test it, I think that if you, say, indent from the first to the second level with tabs (consistently), indent from the second to third level with spaces (consistently), and indent from the third to fourth level with tabs (consistently), it should not complain. Or perhaps I should say "it should complain that you're a bad person and should feel bad, but it won't." :-) (In fact, you could indent one block at the second level with tabs and another with spaces.) Evan --------------enig2051CA9AE17E00279A4BB18C Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJQtm81AAoJEAOzoR8eZTzgKs0H/2Cmf7RX2m8DeOniHvR1C3Ni /4Hf90/ezZmbuYn6Aq+G+obAwuvj4QEzfPyFsz9ENa/RPgyykZ2XymJuxKIO8H/U 4P0rL5gCiHNHEH3EhCAb9DqY7FeSy/JCY6NSOSWL+pyGkjtZ9ut+au54knGvkc4Z NQlvJgNcxUxazdHSnLdB8SdPLbOXuKgWMnHAEmNpumRBeE3EEf5lA9V5nFWmwwlN vVbXJJ2j1oa/j8hH6d2u1O1O05ST62F8I4OwJICacx8Uf7V3RtbDDJy9HADyqu2j zyuk7EIhNB7D6cgmUsxI0m46topwGC6GWNzIWcOXD7uju4boDEpHKIsSe+BYWog= =MtR+ -----END PGP SIGNATURE----- --------------enig2051CA9AE17E00279A4BB18C--