pythonlang2/content/_index.md
SkyTheCodeMaster b2a4e0ff2f Fix your shit
Most of the "points" you had in here are completely ridiculous and make no sense in the modern versions of Python.
Maybe you should stop using Python from the 90s and use the latest version.

Signed-off-by: SkyTheCodeMaster <pythoniscool@skystuff.games>
2022-05-04 22:32:08 +00:00

2.7 KiB

+++ title = "Why Python is a 'bad' language" +++

{{ sec_header(name="Weird Syntax") }}

  • It is hard to read, because it is missing semicolons and braces.
  • Indentation-dependant scopes make multiple statements on one line look horrible.
  • Doc comments
    • They go under what they are documenting, which looks wrong and is very unusual.
  • The def keyword does not imply a function, so one may think it is declaring a variable, or something else.
  • Strange naming
    • Exception handling using raise and except instead of the usual throw and catch. There is literally no point to do this, and it confuses users.
    • Same goes for elif instead of else if. This is just pointless, and again looks like a lazy implementation.
  • Normal if and else statements are not expressions. If they were, the additional ternary operator syntax would be completely redundant, and the code would be cleaner.
  • The syntax for inheritance looks really confusing. class Foo(Bar) looks like Foo has a constructor that takes a Bar as an argument, and not like Foo extends Bar.
  • For some reason, the pass keyword exists. Why can't we just leave the block empty or omit the :? Yet another lazy implementation!
  • True and False are capitalized which is unconventional.

{{ sec_header(name="Dynamic Typing") }}

  • Passing an invalid type into a function may cause unpredictable behaviour. Manual type checks are annoying, and type hints are still just hints.
  • A function can return whatever type it wants, so it is hard to work with and unpredictable.
  • Variables don't need to be declared. This leads to many issues, such as accidentally overwriting other variables with the same name, or typos going undetected.
  • A variable's type may be changed after its assignment, making it harder to work with.

{{ sec_header(name="Poorly done Classes") }}

  • The self parameter being passed into functions explicitly is pointless boilerplate. Instead it should just be there implicitly, and static functions should be declared with a keyword such as static.
  • Fields do not need to be declared. This leads to issues mentioned before. It also makes the data a class stores undefined, making it harder to work with. It is recommended to declare fields, but unfortunately not enforced.

{{ sec_header(name="Other Issues") }}

  • Operator chaning often works in completely nonsensical ways. For example False == False in [False] is treated as False == False and False in [False] and not as something that makes sense such as (False == False) in [False] or False == (False in [False]).

{{ sec_header(name="Conclusion") }}

Python is a perfectly fine language for beginners and experienced devs alike. There is nothing wrong with using it directly, or programs made with it.