"Goto" statement in Python

Rob Gaddi rgaddi at highlandtechnology.invalid
Thu Apr 13 13:26:42 EDT 2017


On 04/13/2017 10:13 AM, Rustom Mody wrote:
> On Thursday, April 13, 2017 at 10:19:33 PM UTC+5:30, Ian wrote:
>> On Thu, Apr 13, 2017 at 10:23 AM, Mikhail V  wrote:
>>> Now I wonder, have we already collected *all* bells and whistles of Python
>>> in these two examples, or is there something else for expressing trivial thing.
>>
>> Functions and exceptions are considered "bells and whistles"?
>
> People's tastes differ… violently on
> - food
> - music
> - opposite sex
>
> What to do??
> Ask Trump?
> [I guess we now need a Godwin 2.0 with :s/Hitler/Trump ]
>
> I wonder if you noticed that you classed functions together with exceptions...
> presumably as basic elements.
> And that the bedrock of much contemporary computer technology — linux-kernel,
> even (C)Python itself, viz C — does not support one of these
>

No, C doesn't support exception handling.  As a result, handling error 
conditions in C is a huge pain for which (forward-only) goto is often, 
while not the only remedy, the least painful one.  Or if you've really 
developed a need for self-harm, setjmp/longjmp.  Or, as is more 
frequently the case in code in the wild, error conditions simply don't 
get checked for and come as a surprise and/or segfault later on.

Python is a radically higher level language than C.  Python supports 
different structures than C, largely and specifically so that you don't 
have to do things in some of the error-prone ways you would do them in 
C.  Therefore, a given task should be solved differently in Python than 
in C.

I try very hard to write Python when I write Python, and to write C when 
I write C.  And to write through the tears when I write C++.

-- 
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.


More information about the Python-list mailing list