• 0 Posts
  • 3 Comments
Joined 3 years ago
cake
Cake day: June 24th, 2023

help-circle
  • Yeah, some weird accusations. Python has had classes since its inception (1.0).

    Also the image in the post makes no sense. It shows multiple (Spidey) instances all pointing to each other which is not how self works. self is just a parameter that may contain different instances depending how it was called. This is also true for any other parameters in any function, each time a function is called it may have a different instance.


  • You don’t reference self when calling a method, what on earth are you talking about? You start with the instance when calling the method, like most/all other OOP languages.

    Also there are benefits with the explicit self/this to access instance properties. In C++ you need to make sure all class properties/members have a naming scheme that does not conflict with potential parameter names or other names of other variables.


  • This is just wrong, the compiler (and linker) knows exactly what the program does as it has the ENTIRE source code available. Compilers have been so good the last 20 years that it is quite hard to write things faster in assembly/machine code.

    One of the harder parts about assembly is keeping track of which registers a subroutine uses and which one is available, as the program grows larger you might be forced to push/pop to the stack all the time. Inlining code is also difficult in assembler, the compiler is quite adept at that.

    It might have been true up until the 90s, but then compilers started getting so good (Watcom) there was rarely any point to write assembler code, unless there was some extremely hardware specific thing that needed to be done