Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #16722

Re: whitespace cleanup

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!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <pedro.h.souto@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.059
X-Spam-Evidence '*H*': 0.88; '*S*': 0.00; 'script,': 0.07; 'url:pypi': 0.08; 'wrong,': 0.09; '"right"': 0.16; '10:59': 0.16; 'wrote:': 0.18; 'dec': 0.22; '(or': 0.22; 'header:In-Reply-To:1': 0.22; 'similar,': 0.23; 'code': 0.25; 'pm,': 0.29; 'pattern': 0.30; 'whitespace': 0.30; 'chris': 0.30; 'source': 0.31; 'does': 0.32; 'break': 0.32; 'tue,': 0.32; 'message-id:@gmail.com': 0.33; 'header:User-Agent:1': 0.33; 'to:addr:python-list': 0.34; 'probably': 0.34; 'anything': 0.34; 'something': 0.35; 'url:python': 0.36; 'received:209.85.161': 0.36; 'beginning': 0.36; 'question': 0.36; 'but': 0.37; 'received:192': 0.37; 'received:google.com': 0.37; 'some': 0.38; 'received:209.85': 0.38; 'clearly': 0.39; 'url:org': 0.39; "it's": 0.40; 'received:209': 0.40; 'to:addr:python.org': 0.40; 'received:192.168': 0.40; '2011': 0.61; 'your': 0.61; 'simple,': 0.64; 'url:20': 0.67; 'andrea': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=vpygjr8RoLc1mBWZPihfNbPq0LRyrQ8+M0LbVP/wYcU=; b=UhyWC+pVpoYsy1g+ULpIgKF+hnSu7fd5SvB++9jj+++ZTiXAFkBLiL6xRK/L8UCsvf JlAwaD+ESu9eKUfoXgshFge4CIS6Hi2Rj73/ZaZVaH+dnSEQO0idmsAkxOW1Ga9dT4kv P9/i78rgEozCqoddLIIU1zC9poGXcQZ06iL1I=
Date Tue, 06 Dec 2011 10:17:12 -0200
From "Pedro Henrique G. Souto" <pedro.h.souto@gmail.com>
User-Agent Mozilla/5.0 (Windows NT 6.1; rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version 1.0
To python-list@python.org
Subject Re: whitespace cleanup
References <4EDDFC48.2000903@gmail.com> <4EDE0166.1030006@gmail.com> <4EDE03BD.2030106@gmail.com> <CAPTjJmp3YTMJR8wRasvJZAvShUN0JtF2HSTh_U9r_GTfeaPkFQ@mail.gmail.com>
In-Reply-To <CAPTjJmp3YTMJR8wRasvJZAvShUN0JtF2HSTh_U9r_GTfeaPkFQ@mail.gmail.com>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3344.1323173840.27778.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1323173840 news.xs4all.nl 6861 [2001:888:2000:d::a6]:40572
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:16722

Show key headers only | View raw


On 06/12/2011 10:06, Chris Angelico wrote:
> On Tue, Dec 6, 2011 at 10:59 PM, Andrea Crotti
> <andrea.crotti.0@gmail.com>  wrote:
>> Well it's not so simple, I clearly don't want to strip out whitespace in the
>> beginning of the line,
>> or my nice code will break miserably ;)
>
> The question is: What is "wrong" whitespace? Whatever you declare to
> be wrong, you can probably come up with a regexp or other spec that
> will catch it (or conversely, declare some pattern to be "right" and
> look for anything else).
>
> ChrisA

Something like PythonTidy does what you want?

http://pypi.python.org/pypi/PythonTidy

If you like to write your own script, or if what you want is similar, 
but not the same, the source code is a good place to start:

http://lacusveris.com/PythonTidy/PythonTidy-1.20.python

-- 
Att;
Pedro Henrique G. Souto
<pedro.h.souto@gmail.com>

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: whitespace cleanup "Pedro Henrique G. Souto" <pedro.h.souto@gmail.com> - 2011-12-06 10:17 -0200

csiph-web