[Tutor] What style do you call Python programming?
Steven D'Aprano
steve at pearwood.info
Sat Dec 10 03:55:37 CET 2011
Cranky Frankie wrote:
> I appreciate all the comments in this thread so far, but what I'm
> really looking for is what to call the style of programming where you
> have no direct branching via line numbers, statement names, and gotos.
Structured programming.
> I'm finding that lacking these things that I've been familiar with in
> other languages is good, in that it forces you to really think through
> the best way to organize the logic.
I'm curious what other languages you're familiar with that have GOTOs.
> It seems to me that this is such a big departure from traditional
> procedural styled programming there ought to be a name for it, other
> than structured programming, since you can code that way even with
> line numbers, etc.
"Procedural" and "structured" coding are not opposites. By definition,
procedural coding *must* be structured, but a procedural language can still
include unstructured elements. E.g. both C and Pascal include GOTOs.
Unstructured languages like early BASIC was not procedural, since it lacked
functions, but it did have a very weak structural element in the form of the
GOSUB command.
Did you read the link on Wikipedia?
http://en.wikipedia.org/wiki/Programming_paradigm
Most languages contain elements of more than one style or paradigm, and styles
overlap considerably. E.g. procedural, object-oriented and functional styles
are all sub-types of structured programming.
Python is also an imperative language: you are (generally) responsible for
specifying the order in which statements are executed. But you can also
program in a more declarative style. Google for Python and Prolog to see examples.
> I'd also be interested in reading the Python history file.
This is a good place to start:
http://docs.python.org/py3k/whatsnew/index.html
--
Steven
More information about the Tutor
mailing list