[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [SPAM: 3.500] Re: [pygame] This one baffles me



You should use 4 spaces and no tabs. The only exception is when you are modifying old files that already are using tabs. new files should use 4 spaces per indentation level.
You can read up on this kind of stuff in the python style guide:
http://www.python.org/dev/peps/pep-0008/

yours

//Lorenz


Yanom Mobis wrote:
umm... well i got my editor to display spaces and tabs differently (tabs with an arrow) so i can see where i've accidentally used spaces.

thanks anyway

--- On *Mon, 5/18/09, Nicholas Dudfield /<ndudfield@xxxxxxxxx>/* wrote:


    From: Nicholas Dudfield <ndudfield@xxxxxxxxx>
    Subject: Re: [SPAM: 3.500] Re: [pygame] This one baffles me
    To: pygame-users@xxxxxxxx
    Date: Monday, May 18, 2009, 9:12 AM

    jug wrote:
     > I think you forgot the newline:
     >   .replace("\n"+" "*4, "\n\t")
     >
    No cigar... not even close...

    from __future__ import with_statement

    with open ('perforce_plugin.py', 'r+w') as fh:
       fixed_tabs = fh.read().expandtabs(4)
       fh.seek(0)
       fh.write(fixed_tabs)

    *expandtabs*(s, tabsize=8)
       expandtabs
       <http://pydoc.org/1.6/string.html#-expandtabs>(s [,tabsize]) ->
    string
           Return a copy of the string s with all tab characters replaced
       by the appropriate number of spaces, depending on the current
       column, and the tabsize (default 8).