Experiences/guidance on teaching Python as a first programming language
rustompmody at gmail.com
Wed Dec 18 17:53:05 CET 2013
On Wednesday, December 18, 2013 8:53:54 PM UTC+5:30, Ethan Furman wrote:
> On 12/18/2013 12:18 AM, Steven D'Aprano wrote:
> > On Tue, 17 Dec 2013 22:49:43 -0500, Paul Smith wrote:
> >> On Wed, 2013-12-18 at 01:33 +0000, Steven D'Aprano wrote:
> >>> On 12/17/2013 04:32 PM, Roy Smith wrote:
> >>>> You never have to wonder what the
> >>>> lifetime of an object is,
> >>> Since C isn't object oriented, the lifetime of objects in C is, um, any
> >>> number you like. "The lifetime of objects in <some language with no
> >>> objects> is ONE MILLION YEARS!!!" is as good as any other vacuously
> >>> true statement.
> >> The implication that only an "object oriented" language could have a
> >> concept of object lifetimes is false.
> > Only object-oriented languages have *objects*. C does not have objects,
> > it has values.
> The word 'object' has many more meanings than the one implied by Object Oriented Programming, as you well know.
> > And yes, I'm being pedantic.
> No, you're being an ass.
Is this discussion REALLY happening...??? In a non-programmer/layman forum it
would be completely normal
However given that we are supposedly a programmer list I am incredulous
Here is some innocuous looking python code:
def draw_helper(canvas, level, p1, p2, p3):
if level == 1:
canvas.create_polygon(p1, p2, p3)
p4 = midpoint(p1, p2)
p5 = midpoint(p2, p3)
p6 = midpoint(p1, p3)
draw_helper(canvas, level - 1, p1, p4, p6)
draw_helper(canvas, level - 1, p4, p2, p5)
draw_helper(canvas, level - 1, p6, p5, p3)
And here is what happens when you run it
(More here http://homes.cs.washington.edu/~reges/python/)
Can you really say that what you see in B you can infer from A
WITHOUT RUNNING IT??
The above is the subject that is technically called 'complexity' in
math terms. If we allow the term 'complex' to be more general (like
the argument about 'object') then this becomes the pain and beauty,
the mystery and horror of programming -- seemingly trivial code when
seen as a PROGRAM can endlessly evolve into unimaginable complexity
when elaborated into a PROCESS.
So when Chris/Roy are talking of the simplicity of C's lifetime rules they
are talking of the primitive building blocks to make and understand
And when Steven/Devin are talking of the complexity of the same they are
talking of the arcane results that emerge when those programs run.
And from here its a small step to understand why python's slightly
more complicated semantics result in so much less complexity than
C's seemingly simple rules: C has a double complexity generator --
stack + heap vs python only having a 'managed' heap.
Analogously if the Sierpinsky triangle above were flattened into 1-d
there would be nothing to note about it.
Like python: Boring 'weenie' language... Never segfaults
More information about the Python-list