Goto

bartc bc at freeuk.com
Tue Jan 2 09:51:32 EST 2018


On 29/12/2017 18:11, Chris Angelico wrote:
> On Sat, Dec 30, 2017 at 4:13 AM, bartc <bc at freeuk.com> wrote:
>> If you want to translate code from one language to another, and the source
>> language uses gotos, or uses control structures not available in the target
>> language, then gotos would be very useful in the latter.
>>
> 
> As has already been said in this thread, a competent FORTRAN
> programmer can write FORTRAN code in any language. But if you want to
> actually write Python code, instead of writing FORTRAN code that gets
> run through a Python interpreter, you have to grok the Python way of
> doing things.

That's not true. People should be able to write code as they like using 
the nearest available language and using the style they are most adept 
in and that they find comfortable. /Especially/ if they are coding for 
themselves rather as part of some organisation or within a team.

The choice of language may enforce some changes, but that should be the 
extent of it.

A lot of the so-called 'Pythonic' style I frankly don't care for.

I like to write code in a simple, clean, universal style that everyone 
can understand.

That doesn't mean it has to look like Fortran.

> You can't do that by mechanically transforming source
> code into the syntax of a different language.

(Actually that's exactly what a project of mine from a few years ago was 
trying to do.

Example of 'binary trees' benchmark:

source syntax:    https://pastebin.com/raw/bgfKw2pq

generated Python: https://pastebin.com/raw/XJWjWzpw)

Here, you normally had to be aware when writing in the source language, 
of what target language you were using. Although sometimes exactly the 
same source translated to several targets including Python and Lisp. 
Anyway, this was unsatisfactory as a universal syntax that could be 
translated to any language.)

> People who try to tell you that all programming languages are
> identical, just with different syntax, are doing you a disservice.
> Lisp is not Python is not REXX is not C is not DeScribe Macro
> Language. (Especially the latter. Do NOT try to write C code in DML.
> It'll look ugly. Trust me.

My experiment showed that such people have a point.

-- 
bartc



More information about the Python-list mailing list