Python Interview Questions

Demian Brecht demianbrecht at gmail.com
Mon Jul 9 22:11:52 CEST 2012


On Monday, 9 July 2012 10:40:59 UTC-7, Tim Chase  wrote:
> On 07/09/12 08:25, Roy Smith wrote:
> >> On Tuesday, 30 October 2007 21:24:04 UTC+2, Tim Chase  wrote:
> > 
> >>> - more detailed questions about the std. libraries (such as
> >>>    datetime/email/csv/zipfile/networking/optparse/unittest)
> > 
> > You need to be careful when you ask questions like this.  I would expect 
> > somebody to be aware of those and have a high-level understanding of 
> > what they do, but certainly not remember the details of the exact syntax 
> > and argument order.  Even with stuff I use everyday (like unittest and 
> > datetime), I have a browser open to the reference manual most of the 
> > time.
> 
> Yeah, the aim isn't to grill them on the minutia, but to get a
> feeling that they know the basics.  The zipfile module offers a
> ZipFile object for reading/writing zip files with or without
> compression.  The CSV file allows for reading/writing CSV files with
> definable delimiters and quoting/escaping.  Etc.
> 
> 
> >>> - questions about PDB
> > 
> > Heh.  I would answer that with, "Python Debugger?  I've never used it".
> 
> The ability to know off the top of your head that it's the "Python
> Debugger" is more than enough :-)  That's just first-order
> ignorance:  you know what you don't know and can spend a few minutes
> reading up on it if you need it.  The second[or higher]-order
> ignorance of not knowing what pdb is (or, if you need more powerful
> debugging, how to do it) is sign the person hasn't been programming
> in Python much.
> 
> >>> Python History:
> >>> ===============
> >>> - decorators added in which version?
> >>>
> >>> - "batteries included" SQL-capible DB in which version?
> >>>
> >>> - the difference between "class Foo" and "class Foo(object)"
> >>>
> >>> - questions from "import this" about pythonic code
> > 
> > With the exception of the question about new-style classes, these are 
> > silly questions.  I was around when both decorators and sqlite3 were 
> > added.  I couldn't possible tell you when to any precision better than 
> > "2 dot something". 
> 
> I'd even be satisfied if a person just knew that such features
> weren't there all along and might need to be worked around for older
> deployments.
> 
> > As for the zen of python, it's cute, and a piece of python
> > folklore, but hardly an essential part of being a good python p
> 
> [Ed: something appears to have gotten truncated there]  Yeah, it's
> more about a person being sufficiently steeped in python to know
> bits and pieces of the zen, and their ability to recognize/create
> pythonic code.  I've seen enough Java-written-in-Python to know what
> I don't want :-)
> 
> -tkc

Definitely appreciate your approach, I've asked similar questions when interviewing.

I also usually like to ask what a candidate likes and dislikes about Python, hoping for the GIL to creep up, along with an explanation as to what it is, implementations that don't have it along with methods of getting around the lock (although that would be a fairly advanced topic IMHO). If it doesn't come up, sometimes I'll pop it in depending on their level of experience.



More information about the Python-list mailing list