pythonlang2/content/_index.md

34 lines
2.7 KiB
Markdown
Raw Normal View History

2021-03-12 00:48:24 +01:00
+++
title = "Why Python is a 'bad' language"
2021-03-12 00:48:24 +01:00
+++
{{ 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`.
2021-03-12 00:48:24 +01:00
- 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.
2021-03-12 00:48:24 +01:00
{{ 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.
2021-03-12 00:48:24 +01:00
{{ 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") }}
2021-12-08 13:23:04 +01:00
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.