Currently I'm working on a project that uses a lot of Python to do
data analysis (which is my own doing). I have consistently run into problems
that have been absolutely infuriating Here I will chronicle the things
that give me acid reflux.
1. Lambdas are limited to expressions
2. Implicit references to objects
> a = [[0] * 5] * 5
> a[0][0] = 1
> print(a)
[[1, 0, 0, 0, 0],
[1, 0, 0, 0, 0],
[1, 0, 0, 0, 0],
[1, 0, 0, 0, 0],
[1, 0, 0, 0, 0]]
This has happened to me more than once and it infuriates me.
3. Error messages don't reveal information of values in question
and are often vague and non specific.
array['a'][i]['batz'][k] = 1
Error: Strings are not indexed by keys
4. Functional programming in Python is an ugly mess.
python: [*map(lambda x: f(x) * x['blag'], array)]
[f(x) * x['blag'] for x in array]
vs.
ruby: array.map{ |x| f(x) * x['blag'] }
5. Python breaks design style when it's "convenient"
[<var> for <var> in <iterable> if <expression>]
What the fuck is this ^
<val> if <expr> else <val>
Why does a language that prides iteslf on readability and enforced
code format have oneliners?
Why do they get to break the rules for convenience?
6. Reduce is outside the global namespace
Python really isn't made for functional programming.