Live data from Hacker News

Udacity goes live

udacity.com

31–40 of 45 posts

Re: Udacity goes live

#31
post #21

I'm a little curious about some of the style choices in python code. For example: # used by Sebastian for k in range(len(measurements)): p = sense(p, measurements[k]) vs # shorter, saner, and more Pythonic for m in measurements: p = sense(p, m) I guess the old aphorism applies: a good Pascal programmer can write Pascal in any language. (Not to criticize Sebastian's programming ability, only to wonder about the pedago…

I also thought that was odd, and used the latter version in the first few exercises. But later there was some code of the form:

  def move(p, U):
      q = []
      for i in range(len(p)):
          s = pExact * p[(i-U) % len(p)]
          s = s + pOvershoot * p[(i-U-1) % len(p)]
          s = s + pUndershoot * p[(i-U+1) % len(p)]
          q.append(s)
      return q
where the index is used to access the previous and next elements in a list.

There's a more idiomatic way to get this index variable(http://stackoverflow.com/questions/522563/accessing-the-inde...), but using a consistent, easy to understand iteration method allows the poor confused student (i.e. me) to spend more time focusing on the concept being taught.

So the code could be intentional, or could be an accident. But I expect that sooner rather than later there will be some data to show which method, if any, is better for the students, and the classes will be adjusted accordingly.

By the way, did anyone else find these exercises addictive? I can begin to appreciate why the Farmville cow-clickers keep at it.

Re: Udacity goes live

#32
post #23

I'm having a hard time finding the first homework assignment. Is there one to be found at this point?

No, they'll be posted later.

They added an improved FAQ to the main page of each course, in the overview section.

Re: Udacity goes live

#33
post #25
post #21

I'm a little curious about some of the style choices in python code. For example: # used by Sebastian for k in range(len(measurements)): p = sense(p, measurements[k]) vs # shorter, saner, and more Pythonic for m in measurements: p = sense(p, m) I guess the old aphorism applies: a good Pascal programmer can write Pascal in any language. (Not to criticize Sebastian's programming ability, only to wonder about the pedago…

A great computer scientist != a great programmer.

Yeah, this looks like academic code to me. I've never found an academic codebase that didn't make you want to cry.

Re: Udacity goes live

#34
The course contents doesn't open on a android tablet. It says loading... for sometime, and it just stops after that. I tried with stock browser and Dolphin browser and both have the same issue.

Re: Udacity goes live

#35
post #25
post #21

I'm a little curious about some of the style choices in python code. For example: # used by Sebastian for k in range(len(measurements)): p = sense(p, measurements[k]) vs # shorter, saner, and more Pythonic for m in measurements: p = sense(p, m) I guess the old aphorism applies: a good Pascal programmer can write Pascal in any language. (Not to criticize Sebastian's programming ability, only to wonder about the pedago…

A great computer scientist != a great programmer.

since i'm a target audience for this course (non-technical person aspiring to learn how to code), how would i learn proper programmer convention (ie the Python way) vs. the computer scientist convention?

Re: Udacity goes live

#36
post #21

I'm a little curious about some of the style choices in python code. For example: # used by Sebastian for k in range(len(measurements)): p = sense(p, measurements[k]) vs # shorter, saner, and more Pythonic for m in measurements: p = sense(p, m) I guess the old aphorism applies: a good Pascal programmer can write Pascal in any language. (Not to criticize Sebastian's programming ability, only to wonder about the pedago…

The version used by Sebastian targets a wider audience who are not familiar with the pythonic idioms and have just skimmed a bit of python to do the course. Using a loop over array index is the way many students iterate over an array. This should not reflect on Sebastian's coding ability.

Re: Udacity goes live

#37
post #21

I'm a little curious about some of the style choices in python code. For example: # used by Sebastian for k in range(len(measurements)): p = sense(p, measurements[k]) vs # shorter, saner, and more Pythonic for m in measurements: p = sense(p, m) I guess the old aphorism applies: a good Pascal programmer can write Pascal in any language. (Not to criticize Sebastian's programming ability, only to wonder about the pedago…

  # less readable, unpythonic, but a single expression
  reduce(sense, measurements)

Re: Udacity goes live

#38
post #36
post #21

I'm a little curious about some of the style choices in python code. For example: # used by Sebastian for k in range(len(measurements)): p = sense(p, measurements[k]) vs # shorter, saner, and more Pythonic for m in measurements: p = sense(p, m) I guess the old aphorism applies: a good Pascal programmer can write Pascal in any language. (Not to criticize Sebastian's programming ability, only to wonder about the pedago…

The version used by Sebastian targets a wider audience who are not familiar with the pythonic idioms and have just skimmed a bit of python to do the course. Using a loop over array index is the way many students iterate over an array. This should not reflect on Sebastian's coding ability.

Which makes it easier to translate into typical procedural languages like c and c++, which is not completely irrational to assume for embedded systems like robotics. And because many tricks and concepts will be array-index-based, you can just go ahead and use them right from the start.

Re: Udacity goes live

#39
post #36

Earlier quoted context omitted.

The version used by Sebastian targets a wider audience who are not familiar with the pythonic idioms and have just skimmed a bit of python to do the course. Using a loop over array index is the way many students iterate over an array. This should not reflect on Sebastian's coding ability.

Which makes it easier to translate into typical procedural languages like c and c++, which is not completely irrational to assume for embedded systems like robotics. And because many tricks and concepts will be array-index-based, you can just go ahead and use them right from the start.

In reply to both sks and donald_draper:

I agree that simplicity of learning is a good goal. This is why I didn't raise the issue of the several dozen times where he uses an very ugly for loop where a very nice list comprehension would be the Pythonic thing to do. Being Pythonic is not the highest goal in software, I get that, and if you're trying to focus on learning robotics rather than learning Python, list comprehensions add friction.

But in the case of iteration across a list, using an idiomatic iterator is far from unique to python, and it's very readable to someone who has never seen it.

And I thought about the C/C++ thing, but the reason I said "Pascal programmer" rather than "C programmer" is because surely no-one trying to ease the translation to C would have used all those list.append() calls with which Sebastian is so liberal.

Re: Udacity goes live

#40
post #35
post #25

Earlier quoted context omitted.

A great computer scientist != a great programmer.

since i'm a target audience for this course (non-technical person aspiring to learn how to code), how would i learn proper programmer convention (ie the Python way) vs. the computer scientist convention?

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".

Post reply on HN