new symbol request/idea

Pete Shinners shredwheat at mediaone.net
Fri Apr 13 12:04:59 EDT 2001


i've occasionally thought it would be a good idea for there
to be a special symbol, when found at the start of a line
means "this line has the same indentation as the previous"

everynow and then i just want to cheat the python indentation
around, and there really is no way to do it :[

for example, let's say the "@" symbol could be used to represent
our "indent AT the previous line"

    glBegin(GL_LINES)
    @   glColor(r,g,b)
        glVertex(x,y,z)
        glVertex(x,y,0)
    glEnd()

#or

    deep_involved_code()
    something_not_quite_right()
@print 'SOME DEBUG INFO', x()
    back_to_work()

#or
#in this example there is an "if" block i want to comment
#out temporarily, but not need to change the indentation of
#the whole program.

    prepare_code()
#    if special_case():
@        this_is_how_we_do_it()
        print 'Handled'
    code_as_normal()


anyways, the syntax is slightly unclean enough it wouldn't be
used liberally, but there's simply times i want python to just
ignore the indentation for a couple lines, and there is no way
to do it.

i'm guessing this post will bring forth some rabid resentment,
but it won't stop me from wanting some syntax like this every
now and then.

just sharing.







More information about the Python-list mailing list