On Dec 29, 2019, at 12:52, Richard Damon <rich...@damon-family.org> wrote:
> 
> On 12/29/19 3:13 PM, Andrew Barnert via Python-ideas wrote:
>>> On Dec 29, 2019, at 10:57, Abdur-Rahmaan Janhangeer <arj.pyt...@gmail.com> 
>>> wrote:
>>> 
>>>> On Sun, Dec 29, 2019 at 10:45 PM Antoine Rozo <antoine.r...@gmail.com 
>>>> <mailto:antoine.r...@gmail.com>> wrote:
>>> 
>>>    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.
>>> 
>>> 
>>> Do you see an advantage having in such a  case?
>> 
>> Imagine being able to do debugger-style watchpoints from within your code 
>> without having to run in a debugger. Whenever x becomes 5 on your live 
>> webserver, it logs a stack trace.
>> 
>> You could also use this to validate inputs in a GUI—people already do this 
>> today with Tkinter, which provides variables that can be hooked with 
>> callback functions, but syntactic support would eliminate a lot of the 
>> boilerplate.
>> 
>> You could even use it to add thread safety to single-threaded libraries from 
>> outside (when this becomes true, notify a condition variable…). I think I 
>> wrote a facetious post on my old Stupid Python Ideas blog on all the control 
>> flow statements Python is “missing” and included a when for this purpose.
>> 
>> I don’t think the advantage is anywhere near worth the cost.
> 
> AH, like the old conditional COME FROM statement that was proposed for 
> FORTRAN decades ago.
> 
> The anti-pattern suggested to get away from structured code.

Yeah—and see INTERCAL (and especially the threaded dialect) to demonstrate both 
the fundamental usefulness and the fundamental unreadability of the feature. Of 
course for INTERCAL those are both advantages, rather than an advantage and a 
cost to be balanced. :)

_______________________________________________
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/F6DQHCSXSMQX6Q4IEYLFFLXQA6QT3Q6H/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to