Re: Automated indentation

jredford@lehman.com
Mon, 09 May 94 08:47:18 -0400

>> > waiting-for-someone-to-exclaim-that-the-'end'-word-must-line-up-
>> > under-the-block's-body-instead<0.4-grin>-ly y'rs - tim
>>
>> Personally, I'm waiting for one of the proponents of such a scheme to
>> come up with an implementation. If it works and doesn't render
>> existing Python code illegal (apart from adding the new reserved word
>> 'end') AND enough people can agree one a solution, I'm happy to make
>> it a permanent part of Python.
>>
>> Hint: if you want the 'end' line aligned under the block as Tim
>> suggests you're gonna have a lot more changes to the grammar and
>> compiler to make!

I've already done this. I did this a couple months ago and posted the
diff to the list.

def read(name):
if posixpath.isfile(name):
f = open(name,'r')
db = marshal.load(f)
f.close()
return db
# END
else:
return {}
# END
# END

def write(db,name):
f = open(name,'w')
marshal.dump(db, f)
f.close()
# END

Yes, the word 'END' lines up with the block body instead... py-mode
groks the '# END' tokens properly to allow indent-region & the like to
work.

And it requires no changes to python. I dont see a reason to add this
to python at this late date. Either use emacs, or write a 'indent' for
python code that also groks these.

If people want this, then pester Tim to add it to py-mode. (Tim, I
assume you still have the diff I posted. I havent mangled the new
py-mode yet.)

--
John Redford (AKA GArrow) | 3,600 hours of tape.
jredford@lehman.com       | 5 cans of Scotchguard.