

Python job interview quiz: Check out how you are pythonic. - defuz
http://gistroll.com/rolls/21/horizontal_assessments/new

======
Vaskivo
-> 'If the implementation is easy to explain, it's a good idea.' \- Well, the zen says that it _may_ be a good idea, but i considered it. It gave e a wrong answer.

-> 'squares = [i __2 for i in xrange(10000)] ' & 'squares = (i __2 for i in xrange(10000)) ' \- Although they are similar, they are not the same, as one returns a list and the other a generator. I can index, pop, insert, etc in the list but can't in the generator.

(I cheated on the 5th one. I wasn't sure what (2) * 3 would return. My hunch
was correct though)

\- '(2 or 3) * (5 and 7)' \- I don't feel this is very pythonic. It's a
language trick, and python code shouldn't rely on that.

Got 4/6, failed the 1st and messed up the 5th.

I don't think it's a very good test. To chck for 'pythonism' you should
probably try to see if the applicant knows what the zen _means_. You should
also chack for intermediate/advanced features. List/dict comprehensions and
generator expressions. The data structures, their characteristics and
pitfalls. Properties, magic methods, etc.

I mean, method lookup order in multiple inheritance. Multiple inheritance is
usually a big 'no-no', so I don't feel that it is a worthy question.

I also couldn't see who this test was for. For begginers, pros? What do you
want to see? If they know python? If it's an experienced programmer, he may
not know python, but can master it fast.

Just my 5 cents...

[EDIT] Submitted too early

