New keywords breaking code is why any proposal for a new keyword has to
have a really strong justification. There has to be a large benefit to
balance the implied cost of breaking code.
Your proposal (if I understand it correctly) is that "when" would
execute exactly like "if". That is not a large benefit.
Python also has a strong culture of not using two different names for
the exact same thing.
I can understand the appeal of using a keyword that fits English usage
more closely, but this trade-off isn't worth it.
--Ned.
On 12/29/19 1:45 PM, Abdur-Rahmaan Janhangeer wrote:
Adding a new keyword automatically assumes breaking code.
Yours,
Abdur-Rahmaan Janhangeer
pythonmembers.club <http://www.pythonmembers.club/> | github
<https://github.com/Abdur-rahmaanJ>
Mauritius
On Sun, Dec 29, 2019 at 10:43 PM Nathan <[email protected]
<mailto:[email protected]>> wrote:
This would break any code that uses “when” as a variable name.
https://github.com/search?l=Python&q=when&type=Code
On Sun, Dec 29, 2019 at 11:26 AM Abdur-Rahmaan Janhangeer
<[email protected] <mailto:[email protected]>> wrote:
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 <http://www.pythonmembers.club/> | github
<https://github.com/Abdur-rahmaanJ>
Mauritius
_______________________________________________
Python-ideas mailing list -- [email protected]
<mailto:[email protected]>
To unsubscribe send an email to [email protected]
<mailto:[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/
_______________________________________________
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/ZTZ3RHXXB5NWE6FGEIY7U7DBK5DTCMPN/
Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________
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/7TSLY6BZYAZ2IHLQRX7ULFMMZMQMT4T4/
Code of Conduct: http://python.org/psf/codeofconduct/