
On Mon, Jun 15, 2020 at 03:01:55PM +0000, M Bfmv wrote:
Hey all. Ever had some list comprehension hell in your code? Me neither *whistles 418 happly*...
If you are having list comprehension hell, you are doing too much in list comprehensions. They are a hammer. Not everything is a nail.
I was thinking about this idea and while `this` keyword is equalevant to `self` i have to explain myself.
I use "this" as a variable in some of my code. If you make it a keyword, you will break my code. "self" is not a heyword, it is an ordinary variable.
English is not my main language, sorry for that :' ) Here is my pseudo code.
``` if [i for i in range(10) if i == 11]: print(this)
You don't need a special keyword for that. Just assign it to a variable. this = [i for i in range(10) if i == 11] if this: print(this) What's wrong with this solution? You mention it at the end of your message, as if it was something to be avoided. Or in 3.8 and after: if this := [i for i in range(10) if i == 11]: print(this) -- Steven