Hi, Adding a new keyword will break many code because "when" would be a new reserved word, and may currently be used as a variable name. Also, "when" is not an equivalent of "if", it has a time-related connotation. If I see a "when" keyword in a code, I will think that the body will be executed later, when the expression will be true.
Regards, Le dim. 29 déc. 2019 à 19:29, Abdur-Rahmaan Janhangeer <[email protected]> a écrit : > > Greetings list, > > I was wondering if adding the When keyword is a good idea. > Normally every when is theoretically an if as you can't be sure if the event > will 100% come to pass. > > if x == 5: > ... > else: > ... > > However, we use the when keyword in normal language. When you reach home, > phone me. When you pass this avenue, turn right etc. Using it in programming > might convey the intent of the programmer. > > when x == 5: > ... > else: > ... > > which still sells the idea of maybe if but hints away the expectation of the > author. > > Yours, > > Abdur-Rahmaan Janhangeer > pythonmembers.club | github > Mauritius > _______________________________________________ > Python-ideas mailing list -- [email protected] > To unsubscribe send an email to [email protected] > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/[email protected]/message/3VOQUSHPYTKLL65V6BUN4MMKKJOXCIKO/ > Code of Conduct: http://python.org/psf/codeofconduct/ -- Antoine Rozo _______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/JGWIQPG5VVHVJC2SLJEKD5WZM32W7GC2/ Code of Conduct: http://python.org/psf/codeofconduct/
