10 Python One-liners To Impress Your Friends

  • I find it weird that the author writes about one-liners in python without knowing about list comprehensions

  • 10 Python one-liners to piss off your colleagues by ignoring the Zen.

    Seriously though, some of these are ridiculously unreadable so think twice before using any for anything more than theory.

  • Yet the most useful oneliner is missing:

        python -m SimpleHTTPServer

  • Number 5 should read (not that it matters): print map(lambda x: "Happy Birthday " + ("to you" if x != 2 else "dear Name"),range(4))

    In general, I was expecting more. I was hoping for some slightly more obscure examples, though I guess the point is that many common problems are 1 liners in Python.

  • Why is number 1 better than just:

        [x*2 for x in range(1, 11)]

  • sigh ... when will people learn ... one-liners are not good. Especially when they lead to bugs. For example #4 in the list. If you that didn't jump out to you as a bug. You are a fucking idiot and shouldn't be writing production code.

  • "Error establishing a database connection"

    Very funny...

    Dumb indian script kiddies... sigh

  • These seem ridiculously mundane.

  • undefined