Experiences/guidance on teaching Python as a first programming language

Steven D'Aprano steve at pearwood.info
Tue Dec 17 20:33:03 EST 2013


On Tue, 17 Dec 2013 19:32:20 -0500, Roy Smith wrote:

> There's very few mysteries in C.

Apart from "What the hell does this piece of code actually do?". It's no 
coincidence that C, and Perl which borrows a lot of syntax from C, are 
the two champion languages for writing obfuscated code.

And "What does 'implementation-specific undefined behaviour' actually 
mean in practice?", another common question when dealing with C.

And most importantly, "how many asterisks do I need, and where do I put 
them?" (only half joking).


> 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.


> or be mystified by which of the 7 signatures
> of Foo.foo() are going to get called, 

Is that even possible in C? If Foo is a struct, and Foo.foo a member, I 
don't think C has first-class functions and so Foo.foo can't be callable. 
But if I'm wrong, and it is callable, then surely with no arguments there 
can only be one signature that Foo.foo() might call, even if C supported 
generic functions, which I don't believe it does.

(You can simulate something rather like generic functions using pointers, 
but that's it.)


> or just what operation "x + y" is
> actually going to perform.


With no operator overloading, that one at least is correct.



-- 
Steven



More information about the Python-list mailing list