Hacker News new | past | comments | ask | show | jobs | submit login

I got them all right, and I agree that there were many gotchas. For example, the ones about the matrix, the array modification, etc. The only thing worse would have been something like:

https://www.pastery.net/mbeghh/

(it'll print 3)




Hmm. We included those issues, because we see a lot of programmers get stuck on exactly those two bugs! (In all sorts of languages, not just Python). I guess maybe that's the definition of a gotcha -- a thing that a lot of programmers get stuck on? In any case, I don't think it's an arcane gotcha! Being clear about references and shallow / deep copies is important.


Being clear on reference vs value is certainly important, but you lose the ability to honestly call it a programming quiz. Those questions make it a Python quiz - which is fine! But not what you've sold it as.


In that case, by far the biggest Python gotcha is:

    def do_stuff(mylist=[]):
        mylist.append("thing")
Which will lead to the list containing N items after N invocations (i.e. the second function call won't start with an empty list).


Yup, we see that issue too. But in that case, I think it's python specific (how python handles default values). Ruby, for example, does not have that behavior.


These issues might have a place in technical interviews, but framing it as a question the user can get "wrong" feels a bit like you're setting a trap. In a real interview, this would just be a talking point. What would be interesting to an interviewer would be seeing how quickly the interviewee grasps what's happening that is unexpected, and why. Marking the candidate down because they didn't know about these quirks beforehand is kind of missing the point.


do they get stuck on it in quizzes or actual programming? I haven't seen devs, other than new devs, get stuck on this, very rare to see it on stackoverflow other than for students. I think the problem is the lens you are seeing things through is this kind of quiz like thing and what trips programmers up doing a quiz. I'd like to see repeatable research into correlations between a vetting quiz and actual capability of producing software.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: