News for hackers. Stuff that matters.
Re:I have no side code projects to show by srssays on Saturday December 17, 2016 @07:08PM (#13203519)
The problem is that it's bad style to write (in Python 2.x):

    for i in range(n):
        # your code here
because it potentially allocates a lot of memory for no reason whatsoever. It's the equivalent of this C code:

    int* r = calloc(sizeof(int), n);
    for (int j = 0; j < n; j++) r[j] = j;
    for (int j = 0; j < n; j++) {
        int i = r[j];
        // your code here
    }
    free(r);
If you don't want to deal with the distinction then what you can do is just treat range() as deprecated and always use either xrange() or list(xrange()) depending on the situation. But you had probably ought to know about the issue.
Re:I have no side code projects to show by drvdevd on Sunday December 18, 2016 @02:27AM (#13204757)
Ok, I would certainly agree then that I ought to know about that (for Python 2.x).

And here's the thing: despite my rant, given that explanation, I'm going to have to say I respect that as a Python (2.x) interview question.

But that's because I care about performance optimization and good style in every language I use. I'm not sure that everyone else always should or that this should be a deal breaker for a python dev gig.