Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.06; 'conventions': 0.07; 'float': 0.07; 'pointers': 0.09; 'subject:language': 0.09; 'sure,': 0.09; 'things,': 0.09; 'cc:addr :python-list': 0.11; 'translation': 0.12; 'coercion': 0.16; 'frame,': 0.16; 'instruction.': 0.16; 'malloc': 0.16; 'overloaded': 0.16; 'roy': 0.16; 'subject:programming': 0.16; 'wrote:': 0.18; 'do.': 0.18; 'stack': 0.19; 'machine': 0.22; 'cc:addr:python.org': 0.22; "aren't": 0.24; 'cc:2**0': 0.24; 'subject:/': 0.26; 'defined': 0.27; 'header:In-Reply-To:1': 0.27; 'wonder': 0.29; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; 'program,': 0.31; 'though.': 0.31; 'yes.': 0.31; 'figure': 0.32; 'know.': 0.32; 'stuff': 0.32; 'could': 0.34; 'anywhere': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'c++': 0.36; "didn't": 0.36; 'wrong': 0.37; 'being': 0.38; 'work?': 0.38; 'pm,': 0.38; 'url:01': 0.39; 'does': 0.39; 'bad': 0.39; 'url:2012': 0.39; 'called': 0.40; 'how': 0.40; 'different': 0.65; 'yes': 0.68; 'smith': 0.68; 'obvious': 0.74; 'yourself': 0.78; 'lot,': 0.93; 'tied': 0.93; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=4wNuk/0+NM9k/ojwOKtF7sR6GgwWITyuL+JY/qDpAns=; b=cJ/xMw7FYewoZ7tdXQIc9pxThBfabMyXhWNSYCmRhOKC4bMUgtmbKCC/PXLcrQANwC mOlEPJHXZ0QtPX71jbzrhX8FIuf+IRFkl0Voi817uIRNCWEnE/VpRgZ3/Q0ebmxLL01B DP6zsLxVIgvqD+5zI5GTcnN9su9qtfAKwp46sH+abI2gJmtVLD2SZ7qszMwDaOntPNu2 PYMerZCGQGm/V8A1gqx/QBtgRrRtenIADf5VoG8PPiEMGRqVkURsZQ4GJfNJAtmn+jFK tEf8QSOIKdRBSPYqbdNebYi54istCoJr5nDUWgbOHkcthowN/sc+kzC9yxYlscdrs5Qo VpjA== X-Received: by 10.49.127.101 with SMTP id nf5mr48906323qeb.61.1387334074298; Tue, 17 Dec 2013 18:34:34 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <20131212213602.806ef8fd2626ca6f34bc83d6@gmx.net> <20131216213225.2006b30246e3a08ee241a191@gmx.net> <20131217165144.39bf9ba1cd4e4f27a96893ca@gmx.net> From: Devin Jeanpierre Date: Tue, 17 Dec 2013 18:33:54 -0800 Subject: Re: Experiences/guidance on teaching Python as a first programming language To: Roy Smith Content-Type: text/plain; charset=UTF-8 Cc: "comp.lang.python" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 37 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1387334077 news.xs4all.nl 2927 [2001:888:2000:d::a6]:35772 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:62253 On Tue, Dec 17, 2013 at 4:32 PM, Roy Smith wrote: > There's very few mysteries in C. You never have to wonder what the > lifetime of an object is Yes you do. Lifetimes are hard, because you need to malloc a lot, and there is no defined lifetime for pointers -- they could last for just the lifetime of a stack frame, or until the end of the program, or anywhere in-between, and it's impossible to know for sure, and if you get it wrong your program crashes. So there's all these conventions you have to come up with like "borrowing" and "owning", but they aren't compiler-enforced, so you still have to figure it out, and you will get it wrong. Successors like C++ mitigate these issues with destructors (allowing heap-allocated stuff to be tied to the lifetime of a stack), and smart pointers and so on. > , or be mystified by which of the 7 signatures > of Foo.foo() are going to get called C still has overloaded functions, just fewer of them. It'll still mystify you when you encounter it, though. http://www.robertgamble.net/2012/01/c11-generic-selections.html > , or just what operation "x + y" is > actually going to perform. I don't know. Will it do float addition? int addition? size_t addition? How does coercion work? + can do many different things, it's not just a straight translation to an obvious machine instruction. > If you maim yourself with a razor-sharp chisel, do you blame the chisel > for being a bad tool? If I didn't need it to be that sharp, then yes. -- Devin