On Tue, May 4, 2010 at 08:27, Zvezdan Petkovic <zvez...@zope.com> wrote:
> On May 4, 2010, at 8:41 AM, Antoine Pitrou wrote: > > I think we should reindent all 3 branches. Most of the work can probably > be scripted (str.replace("\t", " " * 4)), and then a visual pass is > necessary to fix vertical alignments and the like. > > > > > I think we should reindent all 3 branches. Most of the work can probably > be scripted (str.replace("\t", " " * 4)), and then a visual pass is > necessary to fix vertical alignments and the like. > > Is it really that simple? > > People often do the following: > > - use tabs inside strings ("\t" should be used instead); > - use tabs for alignment of inline comments on the right side; > - mix tabs and spaces for indentation whitespace (continuation lines); > - use tabs for alignment inside comments. > > A simple replacement of a tab with 4 spaces as you propose does not work > on such a code. > > To do it properly, you may end up reinventing `indent` (UNIX program). > > What if there was a set of `indent` flags defined for PEP-7? > It would be a nice tool to check whether a new code complies. > `make patchcheck` already does this for Python code. Adding to the command to handle C code wouldn't be hard. -Brett > > However, running `indent` on an existing code would probably cause > non-whitespace changes too as it rearranges the comments and code. > > I'm afraid that any other kind of "script + visual pass + post-edit" would > incur similar changes if done properly (only more tedious). > > So, the question is what bothers developers more: > > - old C files with tab indentation, or > - a lot of changes in version control to fix them? > > Both? > :-) > > Zvezdan > > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/brett%40python.org >
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com