Comments

Philip Swartzleonard starx at pacbell.net
Wed May 8 15:00:41 EDT 2002


Mark McEahern || Wed 08 May 2002 09:30:41a:

> [Sean 'Shaleh' Perry]
>> Sure, but comments are basically free whereas the above creates
>> an anonmymous string which has to be garbage collected.
> 
> Good point!  Thanks.
> 
> By the way, in emacs with python mode, you can select a region and
> comment/uncomment it.  Commenting a block simply prepends ## to each
> line in the block.  Nifty!

def foo:

    # Or if you are writing a comment, just make sure there's a blank 
line above and below and write it all out on one line likt this, then 
hit M-Q or whatever 'fill' is set to, and it will make it into something 
like:

    pass


def foo:
    # Or if you are writing a comment, just make sure there's a blank
    # line above and below and write it all out on one line likt this,
    # then hit M-Q or whatever 'fill' is set to, and it will make it
    # into something like <this>
    pass

I removed the extra blank lines manually. Unfortuantly if you try to do 
something like this without the extra padding

def foo:
    # A comment that is longer than fill length
    c=1
    c=2
    pass

You'll get

def foo: # A comment that is
longer than fill length c=1
c=2 pass

... Is there a way to make emacs ignore lines that wouldn't be 
considered comments by the language when wrapping?

-- 
Philip Sw "Starweaver" [rasx] :: www.rubydragon.com



More information about the Python-list mailing list