Reminds me of "Evolution of a Python Programmer" https://gist.github.com/fmeyer/289467 ... seems like I've perhaps seen other versions of this?
Unpythonic Python
21–30 of 156 posts
Re: Unpythonic Python
#22Earlier quoted context omitted.
A minor quibble, but in Python 3 you can print in a lambda because print is no longer a keyword.
As a non-Python 3 user, I just opened up the python 3 REPL to try something I always find myself wanting to do in tiny little python scripts: map(print, some_list) Unfortunately, it returned a map object, which I guess is also new in Python 3 (I assume it's a lazy application device).
Re: Unpythonic Python
#23A non-programmer’s solution to “Fizz Buzz” https://news.ycombinator.com/item?id=4853509
FizzBuzz Still Works http://www.globalnerdy.com/2012/11/15/fizzbuzz-still-works/
FizzBuzz with CSS http://dabblet.com/gist/2628265
Re: Unpythonic Python
#24Earlier quoted context omitted.
Something annoying about python is that the word "lambda" is so long for what are supposed to be one-off functions. You have f=lambda x,y=1,a='Fizz',b='Buzz': ... But it's actually shorter to say def f(x,y=1,a='Fizz',b='Buzz'): ... I much prefer Haskell's \x -> x Style lambdas.
I generally don't particularly like giving punctuation meaning that, well, isn't punctuating. The bottleneck when writing code is almost never keypresses. I think CoffeeScript gets it probably the most right of languages I've worked with, in that the choice of punctuation makes intuitive sense... "Hey! It's an Arrow. It goes from here to here". FWIW, I don't like the word "lambda" either... Naming things with one let…
Re: Unpythonic Python
#25Earlier quoted context omitted.
I generally don't particularly like giving punctuation meaning that, well, isn't punctuating. The bottleneck when writing code is almost never keypresses. I think CoffeeScript gets it probably the most right of languages I've worked with, in that the choice of punctuation makes intuitive sense... "Hey! It's an Arrow. It goes from here to here". FWIW, I don't like the word "lambda" either... Naming things with one let…
The reasoning behind using '\' for lambda in Haskell was because it sort of looks like a lambda character ( λ vs \ ) if you squint hard enough.
Re: Unpythonic Python
#26This was what one of our Java coworkers wrote a while back: https://gist.github.com/1337/8155054
Yuck.
Re: Unpythonic Python
#27Earlier quoted context omitted.
A minor quibble, but in Python 3 you can print in a lambda because print is no longer a keyword.
As a non-Python 3 user, I just opened up the python 3 REPL to try something I always find myself wanting to do in tiny little python scripts: map(print, some_list) Unfortunately, it returned a map object, which I guess is also new in Python 3 (I assume it's a lazy application device).
print(*[1,2,3], sep='\n')Re: Unpythonic Python
#28Earlier quoted context omitted.
The reasoning behind using '\' for lambda in Haskell was because it sort of looks like a lambda character ( λ vs \ ) if you squint hard enough.
That's just horrible. I don't know what more to say about it than that. How did anyone think this would be a good idea on balance?
Re: Unpythonic Python
#29Playing code golf with Python, this is the shortest I could get: https://gist.github.com/tghw/3702360 Definitely a little unpythonic.
Something annoying about python is that the word "lambda" is so long for what are supposed to be one-off functions. You have f=lambda x,y=1,a='Fizz',b='Buzz': ... But it's actually shorter to say def f(x,y=1,a='Fizz',b='Buzz'): ... I much prefer Haskell's \x -> x Style lambdas.
If you don't like typing it, have a macro. Otherwise, as Objective C shows, the verbosity of code is not relevant at all. It's what it says and what it does, which is.
Re: Unpythonic Python
#30Earlier quoted context omitted.
A minor quibble, but in Python 3 you can print in a lambda because print is no longer a keyword.
As a non-Python 3 user, I just opened up the python 3 REPL to try something I always find myself wanting to do in tiny little python scripts: map(print, some_list) Unfortunately, it returned a map object, which I guess is also new in Python 3 (I assume it's a lazy application device).