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
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/YX2NNZTDGQ6LJ74VJJVVXZVH6HVRUX5W/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to