Why does a = a[0] = [0] create a self-referential list in Python?
susam.in
susam.in
Looking through the archives, it's a really interesting blog in general
Eg. This is wrong in python, while it would be allowed in c-like languages
print(a=5) print(a:=5)Fix the bugs, improve performance, sort out packaging. Leave the language as it is, improve the implementation. It is already possible to write any kind of software using existing features.
Let's avoid making this language harder than it has to be. It was a truly simple language, now it is turning into Frankenstein's monster and you have to google for new added syntax every time you need to use it.
I converted some projects to pyproject.toml (the new standard for defining a project) and between it and the Poetry build/packaging tool it's pretty much solved the packaging nightmare.
There is now a branch of CPython that removes the GIL with significantly better performance in some benchmarks. There is active discussion on the mailing lists about how to get it into mainline.
With setuptools, I just make setup.py and run pip install inside the root directory. If I have wheel, pip builds a wheel for my package.
Sorry, but I don't want to learn yet another packaging meta-language when plain Python worked fine for decades. Python already tried with setup.cfg ini files and people rejected it. Why would pyproject.toml be any better?
Why not improve setuptools instead? That is what sorting out packaging means. Stop copying other languages and focus on Python. Core devs took typing syntax, pattern matching and packaging from Rust and bolted it all on Python like it fits.
Well, it does not fit. Stick to your own.
Since build is semi-official Python project, I will use it instead of Poetry. We can no longer rely on setup.py, it seems.
Thanks.
Installation is a mess, and official recommendation of "copying a powershell line" was already a red flag. Now I can't remove it.
Poetry is a convoluted, insecure mess. Please avoid it and use official PyPi recommendations.
None of the things you mentioned were invented by Rust.
In `if a == b == c`, the value of `b` is evaluated only once, even if `b` is in fact a bigger/side-effecting expression, and `c` might not be evaluated at all.
In `a = b = c`, the `c` is evaluated first, and then `a` and `b` are assigned to, left-to-right.
a = b = expr
and have both a and b end up with the value of expr. And by defining it in the fashion that it does, it only requires the target list expressions to be evaluated once as an lvalue (or whatever python's equivalent is).Presumably Python does the assignments in left-to-right order because any observable side-effects in the evaluations of a and b would be expected to be in left-to-right order. It just results in counterintuitive behavior like this.