This is valid Python syntax
This is valid Python syntax


Some surprising, but valid, python syntax examples.
This is valid Python syntax
Some surprising, but valid, python syntax examples.
Hey, I do Perl for money, you can't scare me.
People designing Python surly didn't think of this. And when they see this now, the reaction would probably be "this should not be in any codebase, ever". But it can be. It is valid Python.
And it's a consequence of pushing features like unpacking and array comprehension and slice assigning and f-strings without fully exploring how they will interfere. One could argue that Python would be better of without some of these features.
But I don't blame them - exploring all possible combinations of features is just too much. The number of combinations grows exponentially and even if you have a fuzzer generating all possible expressions, you don't have enough time in your life to review all of the combinations.
Ultimately it's about the project leader what kind of code gets in.
You can write unmaintanable code in every language - some even ascending to esoteric levels, like JsFuck
Well, I'm saying that we could design a language where code would have to be formatted, so it would not be up to the project leader, at least syntactically.
I really don't see this as an issue, you could find this in any programming language. If you decide to abuse it, that's up to you