goldb.org home

AS OF MAY 2008, THIS BLOG IS NO LONGER BEING UPDATED.
Visit the new blog at: http://coreygoldberg.blogspot.com



 Sunday, February 25, 2007

4-Space Indents - 4Eva!

I personally use 4-space indents when I write code (in any language, period).


Oddly... in Python, where whitespace matters, there is no single common practice (which would fit in nicely with Python's TOOWTDI ideology).

Some observations of source code indentations in Python:

  • I mostly see 4-space indents in code I read (colleagues, libraries, 3rd party code)
  • Python's own source (the Python parts) use 4-space indents
  • Google uses 2-space indents in their Python
  • I hate tabs (if I randomly sucker-punch you, this is why)


Guido van Rossum (creator, lead developer, and BDFL of Python) writes

"If it uses two-space indents, it's corporate code; if it uses four-space indents, it's open source. (If it uses tabs, I didn't write it! :)"
#    Comments [0] |
Comments are closed.