57) Interview questions

I’ve heard before that “What’s the worst code that you’ve seen recently?” is a common question in interviews for programming jobs, and it’s supposed to be a trick question where the only good answer is “My own”.

Today however, I’m providing you with an alternative. This is an actual line of code from something I bastardised, and I left no comment.


It’s not so bad though, the aim of the exercise was to have short code disregarding style. That’s probably the only place I would ever consider nesting a ternary operator in an assignment in a ternary operator in an assignment.

This entry was posted by RobertNewey.

5 thoughts on “57) Interview questions

  1. the for loops in kitten’s crowd surfing code… i cant decide if it’s the worst or best
    for (int i=R ; i– ; ) { … }
    timeline of my face: >=\ :O o_O 😀

    and for complete impenetrability, definitely my own:

    def partial(f, *p): return lambda *q: f(*(p + q))
    def compose(*fs): return lambda x: reduce(lambda a,b: b(a), (fs+(x,))[::-1])
    def represent(n): return compose(*(partial(int.__add__, 1),) * n)(0)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: