Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(list have item) instate (item in list) #87300

Closed
mablue mannequin opened this issue Feb 5, 2021 · 7 comments
Closed

(list have item) instate (item in list) #87300

mablue mannequin opened this issue Feb 5, 2021 · 7 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes type-bug An unexpected behavior, bug, or error

Comments

@mablue
Copy link
Mannequin

mablue mannequin commented Feb 5, 2021

BPO 43134
Nosy @sweeneyde, @iritkatriel, @mablue

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2021-02-08.17:28:41.978>
created_at = <Date 2021-02-05.10:20:50.224>
labels = ['3.8', 'type-bug', '3.7', '3.9', '3.10']
title = '(list have item) instate (item in list)'
updated_at = <Date 2021-02-14.17:47:15.090>
user = 'https://github.com/mablue'

bugs.python.org fields:

activity = <Date 2021-02-14.17:47:15.090>
actor = 'mark.dickinson'
assignee = 'none'
closed = True
closed_date = <Date 2021-02-08.17:28:41.978>
closer = 'mark.dickinson'
components = []
creation = <Date 2021-02-05.10:20:50.224>
creator = 'mablue'
dependencies = []
files = []
hgrepos = []
issue_num = 43134
keywords = []
message_count = 7.0
messages = ['386522', '386534', '386536', '386618', '386619', '386633', '386944']
nosy_count = 3.0
nosy_names = ['Dennis Sweeney', 'iritkatriel', 'mablue']
pr_nums = []
priority = 'normal'
resolution = 'rejected'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue43134'
versions = ['Python 3.6', 'Python 3.7', 'Python 3.8', 'Python 3.9', 'Python 3.10']

@mablue
Copy link
Mannequin Author

mablue mannequin commented Feb 5, 2021

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!

@mablue mablue mannequin added 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes type-bug An unexpected behavior, bug, or error labels Feb 5, 2021
@sweeneyde
Copy link
Member

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."

@iritkatriel
Copy link
Member

I agree with Dennis' comments. New syntax should make the language more powerful, not reduce 2 lines to a 1-liner.

@mablue
Copy link
Mannequin Author

mablue mannequin commented Feb 8, 2021

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!

@mablue
Copy link
Mannequin Author

mablue mannequin commented Feb 8, 2021

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?

@mablue mablue mannequin reopened this Feb 8, 2021
@mablue mablue mannequin reopened this Feb 8, 2021
@mdickinson
Copy link
Member

@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.

@mablue
Copy link
Mannequin Author

mablue mannequin commented Feb 14, 2021

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 work.you know why?
Cuz its the only way to do it without reversing the rules.
And at the end he reversed the rules!

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants