Python questions from C/Perl/Java programmer

Peter Schneider-Kamp nowonder at pool.informatik.rwth-aachen.de
Tue Jul 25 02:23:49 EDT 2000


David Bolen wrote:
> 
> I still occasionally miss the trailing braces at the bottom of heavily
> indented blocks, if only as a place to "hang" my comments about what
> block they are closing - of course that very construct was because
> even in C/C++ it was far from clear in some cases from just looking at the
> brace :-)

Then just use Tools/scripts/pindent.py

BTW: If you ever mess up your indentation, but you still have valid
     #end directives, you can reindent easily.
     As a bonus you will be able to reformat your code to different
     tab/space settings. Quoting from the CVS version:

***
usage: pindent (-c|-d|-r) [-s stepsize] [-t tabsize] [-e] [file] ...
-c         : complete a correctly indented program (add #end directives)
-d         : delete #end directives
-r         : reformat a completed program (use #end directives)
-s stepsize: indentation step (default %(STEPSIZE)d)
-t tabsize : the worth in spaces of a tab (default %(TABSIZE)d)
-e         : expand TABs into spaces (defailt OFF)
[file] ... : files are changed in place, with backups in file~
If no files are specified or a single - is given,
the program acts as a filter (reads stdin, writes stdout).
***

Peter
--
Peter Schneider-Kamp          ++47-7388-7331
Herman Krags veg 51-11        mailto:peter at schneider-kamp.de
N-7050 Trondheim              http://schneider-kamp.de




More information about the Python-list mailing list