just started trying Python, and..
1: Python doesn't have constants. you can't do
class C {
const FOO=123;
}
in Python. (however "constants" are conventionally ALL_UPPERCASE, and linters may complain if you're modifying an ALL_UPPERCASE)
2: Python doesn't support private members, everyting is always public, you can't do:
class C {
private const FOO=123;
}
in Python. (however private members are conventionally prefixed with _ , eg _FOO=123 is the similar to a "private constant FOO")
3: argument and return types are completely ignored in Python:
4: binary data seems to be a royal pain in Python.. want to write \xFF to stdout in python? try
import sys;
str = "\xFF";
sys.stdout.buffer.write(str.encode("raw_unicode_escape"));
yeah... compare that with php:
echo "\xFF";
5: you can't really pass strings by reference. want to port a function like
<?php
function f(string &$str): void {
$str="foo";
}
$str="a";
f($str1);
to Python? it can't really do that, you have to dick around it somehow, like accepting a list with your string in index [0].. the equivalent Python function would be something like
def f(listWithStringInIndex0: list)->None:
listWithStringInIndex0[0]="foo";
str="a";
hackyList=[str];
f(hackyList);
str=hackyList[0];
Unimpressive, Python..