News for hackers. Stuff that matters.
Re:Udacity goes live by jholman on Tuesday February 21, 2012 @03:18PM (#3617907)
The first observation is that there is no computer scientist convention, only a heterogeneous collection of bad habits. :) Again, unlike this post's uncle and grandparent, I'm unwilling to assume that Sebastian is a bad coder in general, but this particular code is unPythonic. Maybe that's because he's a bad coder, maybe that's because he had teaching goals that I don't fully understand.

I am aware of two reasonable answers to the "how do I learn idiomatic style" question (in any language, although Python is the only language in which I personally have deliberately sought a better accent).

1) Read great codebases. For Python, the #1 target here is probably the standard library. People also often mention high-profile projects like Django or Twisted; since I haven't tried that I don't know what percentage of that code is beautiful, but I'm guessing it's probably a mix (so you'd have to apply some judgement).

2) The path I have taken is to read a lot of blogs and Stack Overflow questions and so on. Consider this: http://stackoverflow.com/search?q=pythonic In particular, answers by Alex Martelli are reliably very informative (even if I find his prose style a little sub-optimal).

3) Oh, and this is a bit abstract, but if you haven't typed 'import this' into your Python interpreter, you should do that, for some guidance about the abstract ethics of "being Pythonic".

There are no comments on this comment yet.