Python interview questions

Started by VelMurugan, Sep 14, 2008, 05:10 AM

Previous topic - Next topic

VelMurugan

Python interview questions

comp.lang.python group recently had a discussion on which interview questions to ask a candidate, with Tim Chase suggesting the following list (redacted from original to include just Python-related material). As you can see, some generic programming questions and some process questions made the list:

Do they know a tuple/list/dict when they see it?

When to use list vs. tuple vs. dictionary vs. set?

Can they use list comprehensions (and know when not to abuse them?)

Can they use tuple unpacking for assignment?

String building. Do they use "+=" or do they build a list and use .join() to recombine them efficiently?

Truth-value testing questions and observations (do they write "if x == True" or do they just write "if x")?

Basic file-processing (iterating over a file's lines)

Basic understanding of exception handling

Questions about the standard library ("do you know if there's a standard library for doing X?", or "in which library would you find [common functionality Y]?") Most of these are related to the more common libraries such as os/os.path/sys/re/itertools

Questions about iterators/generators

Questions about map/reduce/sum/etc family of functions

Questions about "special" methods (__foo__)

Can they manipulate functions as first-class objects (Python makes it easy, but do they know how)

More detailed questions about the std. libraries (such as datetime/email/csv/zipfile/networking/optparse/unittest)

Questions about testing (unittests/doctests)

Questions about docstrings vs. comments, and the "Why" of them

More detailed questions about regular expressions

Questions about mutability

Keyword/list parameters and unpacked keyword arguments

Questions about popular 3rd-party toolkits (BeautifulSoup, pyparsing...mostly if they know about them and when to use them, not so much about implementation details)

Questions about monkey-patching

Questions about PDB

Questions about properties vs. getters/setters

Questions about classmethods

Questions about scope/name-resolution

Use of lambda

Decorators added in which version?

SQL-capable DB in which version?

The difference between "class Foo" and "class Foo(object)"

Questions from "import this" about pythonic code

What do they know about various Python web frameworks (knowing a few names is usually good enough, though knowledge about the frameworks is a nice plus) such as Django, TurboGears, Zope, etc.

What do they know about various Python GUI frameworks and the pros/cons of them (tkinter, wx, pykde, etc)

Where do they go with Python related questions (c.l.p, google, google-groups, etc)