Python Rocks! - get rid of colons

Tim Peters tim_one at email.msn.com
Thu Jan 20 18:53:12 EST 2000


[posted & mailed]

[tye4]
> I intend to modify the language's syntax to add
> 'end' delimiters for the blocks.

[Sami Hangaslammi]
> Wouldn't it be better (and easier) to write a script
> that converts between .py and .pye (python with end
> delimeters) scripts. This would allow you to both
> use existing Python libraries and distribute modules
> you have made to others.

[tye4]
> Brilliant idea. Thanks. That's a lot less work than I
> had planned.

As I mentioned a couple days ago in this thread, 99% of such a script ships
with Python, in Tools/Scripts/pindent.py.  From the top of that file:

# This file contains a class and a main program that
# perform two related (though complimentary) formatting
# operations on Python programs.  When called as
# "pindent -c", it takes a valid Python program as input
# and outputs a version augmented with block-closing
# comments.  When called as "pindent -r" it assumes its
# input is a Python program with block-closing comments
# but with its indentation messed up, and outputs a
# properly indented version.

I haven't used this script myself (I prefer indentation, for reasons covered
earlier), but there's no good reason it *can't* be used for its stated
purpose <wink>.

block-closing-ly y'rs  - tim






More information about the Python-list mailing list