News for hackers. Stuff that matters.
Re:Why Python rocks for research by hogu on Wednesday November 03, 2010 @10:39AM (#1864914)
I wasn't aware of pep8 when I started, most science people arrive at python from a different path. What I mean is, for a long time I knew much more about numpy than about python itself.

there are some things in pep8 that are bad for science, the spaces around operations, and also the 80 chars to a line... scientific expressions are often long and complicated, yes you can do it while adhering to pep8, but its kind of a PITA

Re:Why Python rocks for research by ogrisel on Wednesday November 03, 2010 @11:23AM (#1865083)
The 80 chars limit has a justification: expressions that don't fit on 80 chars (or two lines using parens) are not readable anyway. In such a case temporary variables with meaningful names would both help respect the 80 chars constraint and make the expression easier to understand by the reader.

Furthermore having 80 chars is great to have vertically split editors with the code on one panel and the tests or the documentation on the other panel.

Re:Why Python rocks for research by Goladus on Wednesday November 03, 2010 @12:47PM (#1865408)
> The 80 chars limit has a justification: expressions that don't fit on 80 chars (or two lines using parens) are not readable anyway

I disagree. There are many cases, especially after 2-3 levels of indentation, where 80 characters is an unreasonably narrow space. I don't have a strong preference for reading code within 80 characters. And I'd much rather comments use 80 characters plus indentation rather than worry about whether I've got my screens vertically split.

> Furthermore having 80 chars is great to have vertically split editors with the code on one panel and the tests or the documentation on the other panel.

Having lines here or there that go beyond 80 characters doesn't completely prevent you from doing this, and having an entire statement on a single line of code makes line-based tools like grep or kill-line more effective.

Limiting to 80 characters is a good idea, but it's easy to see that there are a few significant tradeoffs, and that someone trying to get something done is not going to want to bother.

Re:Why Python rocks for research by follower on Thursday November 04, 2010 @06:02AM (#1868299)
> > The 80 chars limit has a justification: expressions that don't fit on 80 chars (or two lines using parens) are not readable anyway

> I disagree. There are many cases, especially after 2-3 levels of indentation, where 80 characters is an unreasonably narrow space.

Some people would say that after 2-3 levels of indentation you should be looking at refactoring your code. Probably to pull something into a separate function/method.

Re:Why Python rocks for research by Goladus on Thursday November 04, 2010 @02:35PM (#1870165)
I don't think many people would say 2-3 levels is the threshold for refactoring in Python. 3 levels is 1 class, 1 def, and 1 other control structure. Then you have 68 characters left.
Re:Why Python rocks for research by hogu on Wednesday November 03, 2010 @01:35PM (#1865622)
I'm not saying there aren't reasons to have short lines.

But in science, we have longer and more complex expressions in general.

Our priorities are different.