News for hackers. Stuff that matters.
Re:Python Generator Tricks by metachris on Thursday September 30, 2010 @05:24AM (#1742729)
Interesting post -- I've come to appreciate linuxgazette as a pretty good resource.

As a minor sidenote, I personally think 4 spaces for indentation makes the code more readable.

Re:Python Generator Tricks by beambot on Friday October 01, 2010 @11:00AM (#1747228)
The official "python style guide" dictates using 4 spaces for indentation (unless old / legacy code): http://www.python.org/dev/peps/pep-0008/
Re:Python Generator Tricks by bmelton on Thursday September 30, 2010 @08:58AM (#1743091)
I do almost all of my code editing in regular text editors, Vi or Notepad, usually. 4 spaces is impossible for me.

Why do you feel that 4 spaces is better than 5, which is usually the number of spaces represented by \t?

Re:Python Generator Tricks by silvajoao on Thursday September 30, 2010 @09:32AM (#1743180)
In my particular instance of the Universe, \t is usually represented by 8 spaces. I still prefer 4 though.
Re:Python Generator Tricks by bmelton on Thursday September 30, 2010 @02:12PM (#1744217)
As it happens, I can't count. \t IS 8, though hopefully there's some other reason I got downvoted to -4 than that.

Still though, my question remains. Is there a particular reason you prefer 4? Does it affect your workflow in any way or does it just 'look better' in the abstract? I'm curious.

Re:Python Generator Tricks by silvajoao on Thursday September 30, 2010 @03:07PM (#1744425)
I use a single tab for indentation, and too much exposure to Java and the Eclipse default indentation size (4 spaces per tab) made me used to it. I also find it easier to look at python code indented by 4 spaces per tab. Since I also tend to limit line length to 80 chars, 8-spaces tabs would quickly use up precious space.

Linus disagrees: http://lxr.linux.no/linux+v2.6.35.7/Documentation/CodingStyl...

Re:Python Generator Tricks by metachris on Thursday September 30, 2010 @08:28PM (#1745451)
I don't exactly know why, I just find it easier read with 4 spaces. Maybe a subconscious issue about the eyes having to move more with 8 spaces.