Why Python Is Not My Favorite Language (2016)
TL;DR: Author complains because he wants to program Java-style within Python, and he can&#x27;t. He doesn&#x27;t mention <i>real</i> outstanding things that Python needs to solve like the threading&#x2F;async features versus the Global Interpreter Lock (GIL). No, just trivial stuff.<p>Detailed reply:<p>- The author complains: &quot;Most obviously, there’s no such thing as ‘private’. The convention is to prefix things with an underscore, as a way of saying to the user, “don’t touch.”&quot;<p>Yes, underscore is just a convention. But the author ignores that a good Python IDE, like PyCharm, will automatically and explicitly warn you whenever you&#x27;re accessing an &#x27;underscored&#x27; member from outside.<p>- &quot;Python has lambdas, but they’re seriously hamstrung: They can only be a single expression. No statements.&quot;<p>The author ignores that functions are pretty much first class in Python. Thus, if you want a multi-line &#x27;lambda&#x27;, just define a function and pass it around. Yes, they will not be anonymous, but functions can be defined at any inner block, as well, so if you do it that way, you will have no name conflict problems. Very easy to do.<p>- The <i>with</i> statement. &quot;If you had multi-statement lambdas in the language, you could do something like:&quot;<p>I guess the author has not used Python enough, since the example he shows <i>can be done in Python</i>. As I mentioned, you can pass a function as an argument pretty easily.<p>- &quot;Decorators, on the other hand, are just a band-aid over the lack of multi-statement lambdas.&quot;<p>The author hasn&#x27;t got a clue of what is the usefulness of decorators.<p>- Again, complaining about decorator use in Flask:<p><pre><code>    from flask import Flask
    
    app = Flask(__name__)
    
    @app.route(&#x27;&#x2F;&#x27;):
    def index():
        return &#x27;Hello, World!&#x27;
</code></pre>
The author complains that he needs to define a name for index(), while this isn&#x27;t needed in Ruby (under Sinatra).<p>Well, the author should use the Flask framework a little bit more before complaining, because the reason one needs to define a name for the index() function is to be able to... refer to this function later in many occasions!! For example, if i want to get the actual URL that is routed to index() i can use:<p><pre><code>    url_for(&#x27;index&#x27;)
</code></pre>
In this way, you can separate the <i>routes</i> from the view controllers, and thus, you can change the route paths without having to break many parts of the code.<p>- The rest of the article, the author complains that Python &quot;does not have a Type System&quot;. However, the author conveniently ignores many things:<p>a. Python allows to call functions using keyword arguments, which strongly helps preventing bugs since the order of parameters is not going to affect the code <i>and</i> you clearly know what input parameters are you assigning values too.<p>b. You <i>can</i> always insert assert() statements to have a form of type checking. A good IDE, like PyCharm, will then warn you whenever you are calling a function with wrong types, and in runtime the type error will be catched as well.<p>c. If you want static typing at 100%, why are you using Python? Wrong choice.<p>d. There is a specific documentation style that, if you&#x27;re using PyCharm or another decent IDE, will show you the documentation for every parameter as you are writing your function call. If, having this feature, the coder still makes mistakes calling a function with wrong parameter types, then the coder is too stupid to use Python.<p>e. Python is strongly typed, so a wrong input type to a function will cause a runtime error pretty soon, anyways. And, in my opinion, the bugs caused by type mismatches, in a strongly typed languaged, are trivial to solve. The bugs that worry me are the difficult to solve ones, the ones caused by wrong understanding of the problem, etc. Those bugs will never be prevented by a type system.