Skip to content
theRealProHacker edited this page Feb 22, 2023 · 1 revision

Why Python is definitely better than JS

From https://stackoverflow.com/a/2346626/15046005

technically javascript to python would be a decompiler

From https://www.youtube.com/watch?v=G9QTBS2x8U4

JavaScript Was So Bad They Had To Add A Second Mode To Fix It

From https://www.youtube.com/watch?v=aXOChLn5ZdQ&lc=UgzA0qq1X45-ZU337eR4AaABAg

When you code in JS, you always want to shout "F%ck this", but you can't be sure what "this" means in your local environment...

Why the CSS-Specifications are pretty bad

  1. Many Inconsistencies. Very similar concepts have totally different syntaxes. Simple example: rgb and hwb
  2. Sometimes the specifications were done respecting the implementors but then somewhere else they don't care about those at all, and then you see CSS-'Features' that are not supported by a single browser.
  3. Because CSS was sometimes tailored to very old hardware or other almost ancient circumstances, it has a lot of technical debt. Another reason for this is that just like HTML and JS, CSS cannot have breaking changes, even if totally necessary. For example, there are a million ways to say the same thing in CSS (colors, transparency)
  4. But in general, CSS is a simple and effective language to describe how a webpage should look like.
  5. Additionally, Positron has an advantage because it firstly doesn't need to support every feature or every device, currently. And secondly, anyone designing a desktop app with it doesn't need to care about supporting IE7 or similar, in contrast to some actual web-developers.

But actually

ES6 is a pretty well-rounded language with at least two features that Python developers are probably jealous of

  1. Object unpacking

    my_object = {
        "a": 1,
        "b": 2,
    }
    {a,b} = my_object
  2. Anonymous functions that are actual functions

    inc = x => x+1

    Python only has ugly lambdas

    inc = lambda x: x+1

    This might not seem like that big of a difference, but it is, when callbacks become bigger

    window.onload = ()=>{
        console.log("loaded")
        x = 5
        console.log(`I can do whatever I want in these anonymous functions $x`)
        x += 1;
        console.log("x is now", x)
    }

    This is not possible in Python, which makes me at least jealous. However, there is a pretty solid alternative with Python decorators.

    @window.onload
    def _():
        print("loaded)
        x = 5
        print(f'I can do whatever I want in these anonymous functions {x}')
        x += 1;
        print("x is now", x)

the web specs are good too

I like how there is this balance between parties and interests.

First, you have web developers, second you have the spec authors, and then you have the implementors. In some way you can think of these as the three powers of political systems.

  1. L: spec authors
  2. E: implementors
  3. J: web developers

Note: Obviously, a single person can have several roles. So one person could be a web developer and also an implementor.

The similarities might not be obvious, but one example is how spec authors ask implementors before they adopt new "laws". However, one big difference is that implementors are independent and do not have to follow the "laws". Which is obviously totally different to the real world metaphor, however most laws are abided by. Also, web developers have no real power. They can only put pressure on the other two parties. But apart from their powerlessness, they perfectly fit the role of the judge. They judge the other parties' results and give feedback like spec issues, implementation bugs and missing features.