This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: (list have item) instate (item in list)
Type: behavior Stage: resolved
Components: Versions: Python 3.10, Python 3.9, Python 3.8, Python 3.7, Python 3.6
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: Dennis Sweeney, iritkatriel, mablue
Priority: normal Keywords:

Created on 2021-02-05 10:20 by mablue, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (7)
msg386522 - (view) Author: Masoud Azizi (mablue) Date: 2021-02-05 10:20
Please append a code to reverse check?like that?

print([input() for i in'_'*10] have input())

Instade of:
print(input() in [input() for i in'_'*10] )

i want to check that: is last input in the inputs or not!
msg386534 - (view) Author: Dennis Sweeney (Dennis Sweeney) * (Python committer) Date: 2021-02-05 17:55
You could express this as:

a = [input() for i in range(10)]
x = input()
print(x in a)

This is more clear IMO, because if you want to have something happen before something else, it's clearest to put them on separate lines, one after the other.

I also don't like using "a have x" to duplicate the behavior of "x in a", because,
per PEP 20: "There should be one-- and preferably only one --obvious way to do it."
msg386536 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-02-05 18:07
I agree with Dennis' comments. New syntax should make the language more powerful, not reduce 2 lines to a 1-liner.
msg386618 - (view) Author: Masoud Azizi (mablue) Date: 2021-02-08 07:10
English is a powerful language too.
In English we have just one way to say someone have something too. 
there is one way to say that are you have this or not cuz of that:

in this one line simple code we check the search keyword after all 10 inputs
print([input() for i in'_'*10] have input())

but in this code we get the search keyword first so we get 10 value!and it have mistake
print(input() in [input() for i in'_'*10] )

and i said that want to check that: 
is last input in the inputs or not!(secend code is not true code for do that)

Have is not a duplicated command its a natural way that all people use it in his life in his powerful language like English, Turkish, Persian and etc...

Its a powerful command to write codes and think and speak better and/or different!
msg386619 - (view) Author: Masoud Azizi (mablue) Date: 2021-02-08 07:23
powerful languages always reduces multi-lines to one line.
like python than make it ease to say a,b=1,3 and now we shroud have a command to say that i want to search in some one that i know him but still i did not know what i want to search I'm waiting to get that.
like a human that we know that we will speak about him but still we don't know what we want to say about it!
its a root communication skill that we tell some one that:
I have many things,tell me What do you want from me?
msg386633 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2021-02-08 17:28
@Masoud: There's a significant cost to introducing new syntax into Python; there need to be really significant benefits to justify that cost. In this case, the benefits are slight, and nowhere near the threshold needed to justify introducing a new keyword into the language.

Closing again; free free to comment further, but please don't re-open the issue.
msg386944 - (view) Author: Masoud Azizi (mablue) Date: 2021-02-14 10:47
Linus makes the Linux kernel without expecting benefits.
USA start a war against German and Japan in ww2 without expecting benefits.
Some times we should not think about benefits, just we will do it, if its the right thing.
A child never will not born for benefits.
It just born cuz thats only true way to be alive to learn walking well, thinking well and speaking well...
With humans, with computers.
Linus never said that to himself forget that it have not benefits.
He continued without having any observer for his know why?
Cuz its the only way to do it without reversing the rules.
And at the end he reversed the rules!
Date User Action Args
2022-04-11 14:59:41adminsetgithub: 87300
2021-02-14 17:47:15mark.dickinsonsetnosy: - mark.dickinson
2021-02-14 10:47:08mabluesetmessages: + msg386944
2021-02-08 17:28:41mark.dickinsonsetstatus: open -> closed

messages: + msg386633
nosy: + mark.dickinson
2021-02-08 07:38:18mabluesetstatus: closed -> open
2021-02-08 07:23:28mabluesetmessages: + msg386619
2021-02-08 07:10:25mabluesetmessages: + msg386618
2021-02-05 18:07:42iritkatrielsetstatus: open -> closed

nosy: + iritkatriel
messages: + msg386536

resolution: rejected
stage: resolved
2021-02-05 17:55:26Dennis Sweeneysetnosy: + Dennis Sweeney
messages: + msg386534
2021-02-05 10:20:50mabluecreate