10 Python One-liners To Impress Your Friends
codeblog.dhananjaynene.com
10 Python One-liners To Impress Your Friends
1–10 of 20 posts
Re: 10 Python One-liners To Impress Your Friends
#2No Brainfuck interpreter?
Re: 10 Python One-liners To Impress Your Friends
#3Why is number 1 better than just:
[x*2 for x in range(1, 11)]Re: 10 Python One-liners To Impress Your Friends
#4I find it weird that the author writes about one-liners in python without knowing about list comprehensions
Re: 10 Python One-liners To Impress Your Friends
#5Why is number 1 better than just: [x*2 for x in range(1, 11)]
It isn't.
Re: 10 Python One-liners To Impress Your Friends
#610 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.
Re: 10 Python One-liners To Impress Your Friends
#7Why is number 1 better than just: [x*2 for x in range(1, 11)]
I felt the same about number 3.
[x in tweet.split() for x in wordlist]
Seems better to me than map(lambda x: x in tweet.split(),wordlist)
Although the natural thing for me to do would be [x for x in wordlist if x in tweet]
Which both generates a list of words instead of booleans(['scala', 'sbt'] instead of [True, False, False, False, False]) and also matches the 'sbt' in tweet.Re: 10 Python One-liners To Impress Your Friends
#8These seem ridiculously mundane.
Re: 10 Python One-liners To Impress Your Friends
#9sigh ... 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.
Re: 10 Python One-liners To Impress Your Friends
#10Yet the most useful oneliner is missing:
python -m SimpleHTTPServer