[Tutor] What style do you call Python programming?

Steven D'Aprano steve at pearwood.info
Sat Dec 10 04:07:32 CET 2011


Cranky Frankie wrote:
> From: Dave Angel <d at davea.name>
> 
> <<I don't understand your reluctance to use the name that has applied
> for at least 35 years. Just because some of those non-structured
> languages have survived, doesn't take anything away from the term
> procedural.  You can write object oriented code in hex if you really
> want, it doesn't make raw machine language object oriented.>>
> 
> Probably because I work in a shop that still heavily uses older
> languages like COBOL and CULPRIT where you still deal with labels,
> branching, goto, etc. The fact that it is possible to code
> "structured" that way AND the Python way amazes me.

You have misunderstood.

If you call GOTO (or its bizarre cousin, COMEFROM), you are *not* programming 
in a structured way. You are programming in an unstructured way.

Some structured languages, like Cobol, C and Pascal, allow a full or limited 
unstructured style. Some, like ancient Basic, *only* included unstructured 
style -- but even Basic includes GOSUB, which is almost structured.

Cobol 2002 is a mostly structured language, with functions, procedures and 
even objects. Way back in 1959, Cobol was unstructured, but that hasn't been 
the case for some time now. Nevertheless, it does include unstructured 
features, and programmers are free to ignore the structured features and use 
or abuse the unstructured features if they so choose.

Even Python has a limited unstructured feature: exception handling with try 
blocks. This doesn't make Python unstructured. It makes it a structured 
language with one small and limited unstructured feature.



-- 
Steven



More information about the Tutor mailing list