Re: tough-to-explain Python

2009-07-21 Thread Simon Forman
On Mon, Jul 20, 2009 at 9:54 PM, Paul Rubinhttp://phr...@nospam.invalid wrote: Simon Forman sajmik...@gmail.com writes: But I'm glad it's there to study, these are wheels I don't have to invent for myself. http://dwheeler.com/essays/high-assurance-floss.html might be an interesting place to

Re: tough-to-explain Python

2009-07-21 Thread greg
Simon Forman wrote: My understanding (so far) is that you (hope to) /derive/ correct code using formal logic, rather than writing code and then proving its soundness. But to the extent you can rigorously formalise it, all you've done is create Yet Another Programming Language. Which is fine,

Re: tough-to-explain Python

2009-07-21 Thread Paul Rubin
greg g...@cosc.canterbury.ac.nz writes: However, I suspect that you can't improve much on what we've already got without restricting the domain of applicability of the language. Otherwise, you just shift the intellectual bottleneck from writing a correct program to writing correct

Re: tough-to-explain Python

2009-07-20 Thread greg
Calroc wrote: It may be that flawless software is an unreachable asymptote, like the speed of light for matter, but I'm (recently!) convinced that it's a goal worthy of exploration and effort. Seems to me that once you get beyond the toy program stage and try to apply correctness proving to

Re: tough-to-explain Python

2009-07-20 Thread Simon Forman
On Jul 19, 2:51 pm, Paul Rubin http://phr...@nospam.invalid wrote: Calroc forman.si...@gmail.com writes: I'm engaged presently in starting a school to teach programming from the ground up, based roughly on the curriculum outlined in the article I mentioned. ... I'm excited about formal

Re: tough-to-explain Python

2009-07-20 Thread Simon Forman
On Jul 20, 4:00 am, greg g...@cosc.canterbury.ac.nz wrote: Calroc wrote: It may be that flawless software is an unreachable asymptote, like the speed of light for matter, but I'm (recently!) convinced that it's a goal worthy of exploration and effort. Seems to me that once you get beyond

Re: tough-to-explain Python

2009-07-20 Thread Paul Rubin
Simon Forman sajmik...@gmail.com writes: But I'm glad it's there to study, these are wheels I don't have to invent for myself. http://dwheeler.com/essays/high-assurance-floss.html might be an interesting place to start. -- http://mail.python.org/mailman/listinfo/python-list

Re: tough-to-explain Python

2009-07-19 Thread Calroc
On Jul 9, 1:20 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: [...] You'll excuse my skepticism about all these claims about how anyone can program, how easy it is to teach the fundamentals of Turing Machines and functional programming to anybody at all. Prove it. Where are

Re: The meaning of = (Was: tough-to-explain Python)

2009-07-14 Thread Lawrence D'Oliveiro
In message pan.2009.07.14.03.45...@remove.this.cybersource.com.au, Steven D'Aprano wrote: Are we supposed to interpret that post as Dumb Insolence or just Dumb? Insolence indeed ... another wanker to plonk, I think. -- http://mail.python.org/mailman/listinfo/python-list

Re: The meaning of = (Was: tough-to-explain Python)

2009-07-13 Thread Lawrence D'Oliveiro
In message h3bogf$oo...@panix3.panix.com, Aahz wrote: In article h3bagu$52...@lust.ihug.co.nz, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: In message h37gv5$r8...@panix3.panix.com, Aahz wrote: It helps to remember that names and namespaces are in many ways syntactic sugar

Re: tough-to-explain Python

2009-07-11 Thread John O'Hagan
On Fri, 10 Jul 2009, Hendrik van Rooyen wrote: Steven D'Aprano st...@remove-this-cye.com.au wrote: On Wed, 08 Jul 2009 22:05:57 -0700, Simon Forman wrote: [...] Programming is not like any other human activity. In practice? In principle? Programming in principle is not the same as it

Re: tough-to-explain Python

2009-07-11 Thread Piet van Oostrum
I V ivle...@gmail.com (IV) wrote: IV On Fri, 10 Jul 2009 16:27:12 -0400, Terry Reedy wrote: a bug, bug a limitation due to using limited-range numbers. If one uses residue classes instead of integers, and makes no adjustment, I consider it wrong to blame Bentley. IV But it was Bentley

Re: tough-to-explain Python

2009-07-11 Thread Hendrik van Rooyen
Steven D'Aprano st...@remove-this-cyb.ce.com.au wrote: On Fri, 10 Jul 2009 12:54:21 +0200, Hendrik van Rooyen wrote: Steven D'Aprano st...@remove-this-cye.com.au wrote: On Wed, 08 Jul 2009 22:05:57 -0700, Simon Forman wrote: persistent idea out there that programming is a very

Re: tough-to-explain Python

2009-07-11 Thread Hendrik van Rooyen
pdpi pd...@gmail.com wrote; I've always found cooking an apt metaphor for programming. No this is wrong. Writing a recipe or a cookbook is like programming. Cooking, following a recipe, is like running a program. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: tough-to-explain Python

2009-07-11 Thread Scott David Daniels
Steven D'Aprano wrote: Even *soup stock* fits the same profile as what Hendrik claims is almost unique to programming. On its own, soup stock is totally useless. But you make it, now, so you can you feed it into something else later on. Or instant coffee. I think I'll avoid coming to your

Re: tough-to-explain Python

2009-07-11 Thread D'Arcy J.M. Cain
On Sat, 11 Jul 2009 14:01:25 +0200 Hendrik van Rooyen m...@microcorp.co.za wrote: Programming is the step of going from the design to something that tells the machine how to implement the design. The creativity could, arguably, be in the Design. Not in the translation to python, or

Re: tough-to-explain Python

2009-07-11 Thread Hendrik van Rooyen
D'Arcy J.M. Cain d...@druid.net One might also argue that divorcing the design from the code is the problem in a lot of legacy code. See Agile Programming methods. Now you could say that there is a design step still in talking to the client and making a plan in your head or in some notes

Re: tough-to-explain Python

2009-07-11 Thread Hendrik van Rooyen
John O'Hagan wrote: The drawings produced by an architect, the script of a play, the score of a piece of music, and the draft of a piece of legislation are all examples of other things which are useless until they are interpreted in some way. Granted. But... There are countless human

Re: The meaning of = (Was: tough-to-explain Python)

2009-07-11 Thread Lawrence D'Oliveiro
In message h37gv5$r8...@panix3.panix.com, Aahz wrote: It helps to remember that names and namespaces are in many ways syntactic sugar for dicts or lists. Interesting, though, that Python insists on maintaining a distinction between c[x] and c.x, whereas JavaScript doesn't bother. --

Re: tough-to-explain Python

2009-07-11 Thread greg
Hendrik van Rooyen wrote: The creativity could, arguably, be in the Design. Not in the translation to python, or assembler. No way. That is just coding. No, the mechanical part of the process is called compiling, and we have programs to do it for us. By the time you've specified the design

Re: The meaning of = (Was: tough-to-explain Python)

2009-07-11 Thread greg
Lawrence D'Oliveiro wrote: Interesting, though, that Python insists on maintaining a distinction between c[x] and c.x, whereas JavaScript doesn't bother. And that distinction is a good thing. It means, for example, that dictionaries can have methods without colliding with the key space of the

Re: The meaning of = (Was: tough-to-explain Python)

2009-07-11 Thread Aahz
In article h3bagu$52...@lust.ihug.co.nz, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: In message h37gv5$r8...@panix3.panix.com, Aahz wrote: It helps to remember that names and namespaces are in many ways syntactic sugar for dicts or lists. Interesting, though, that Python

Re: tough-to-explain Python

2009-07-10 Thread Hendrik van Rooyen
Steven D'Aprano st...@remove-this-cye.com.au wrote: On Wed, 08 Jul 2009 22:05:57 -0700, Simon Forman wrote: persistent idea out there that programming is a very accessible skill, like cooking or gardening, anyone can do it, and even profit from it, monetarily or otherwise, etc., and to

Re: tough-to-explain Python

2009-07-10 Thread Steven D'Aprano
On Fri, 10 Jul 2009 12:54:21 +0200, Hendrik van Rooyen wrote: Steven D'Aprano st...@remove-this-cye.com.au wrote: On Wed, 08 Jul 2009 22:05:57 -0700, Simon Forman wrote: persistent idea out there that programming is a very accessible skill, like cooking or gardening, anyone can do it,

Re: The meaning of = (Was: tough-to-explain Python)

2009-07-10 Thread Aahz
[excessive quoting ahead, I'm too tired to trim] In article h32i2o$eo...@reader1.panix.com, kj no.em...@please.post wrote: In h32fon$26...@panix3.panix.com a...@pythoncraft.com (Aahz) writes: In article h32eoh$ql...@reader1.panix.com, kj no.em...@please.post wrote: OK, so, scratching from my

Re: tough-to-explain Python

2009-07-10 Thread Steven D'Aprano
On Fri, 10 Jul 2009 08:28:29 -0700, Scott David Daniels wrote: Steven D'Aprano wrote: Even *soup stock* fits the same profile as what Hendrik claims is almost unique to programming. On its own, soup stock is totally useless. But you make it, now, so you can you feed it into something else

Re: tough-to-explain Python

2009-07-10 Thread D'Arcy J.M. Cain
On 10 Jul 2009 15:48:47 GMT Steven D'Aprano st...@remove-this-cybersource.com.au wrote: I meant the instant coffee powder is prepared in advance. It's useless on it's own, but later on you feed it into boiling water, add sugar and milk, and it's slightly less useless. I don't know about

Re: tough-to-explain Python

2009-07-10 Thread pdpi
On Jul 10, 2:11 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Fri, 10 Jul 2009 12:54:21 +0200, Hendrik van Rooyen wrote: Steven D'Aprano st...@remove-this-cye.com.au wrote: On Wed, 08 Jul 2009 22:05:57 -0700, Simon Forman wrote: persistent idea out there that

Re: tough-to-explain Python

2009-07-10 Thread Wesley Chun
On Jul 7, 1:04 pm, kj no.em...@please.post wrote: I'm having a hard time coming up with a reasonable way to explain certain things to programming novices. : How do I explain to rank beginners (no programming experience at all) why x and y remain unchanged above, but not z? : What do

Re: tough-to-explain Python

2009-07-10 Thread Scott David Daniels
Steven D'Aprano wrote: On Fri, 10 Jul 2009 08:28:29 -0700, Scott David Daniels wrote: Steven D'Aprano wrote: Even *soup stock* fits the same profile as what Hendrik claims is almost unique to programming. On its own, soup stock is totally useless. But you make it, now, so you can you feed it

Re: tough-to-explain Python

2009-07-10 Thread Terry Reedy
Steven D'Aprano wrote: On Thu, 09 Jul 2009 23:07:34 -0400, Terry Reedy wrote: The is *not* a bug is Bentley program. This is *not* a bug in Bentley's program. Wow. That's an impressive set of typos :) 3. Way beneath my usual standards ;-) It is a bug in bad, buggy, insane integer

Re: tough-to-explain Python

2009-07-10 Thread I V
On Fri, 10 Jul 2009 16:27:12 -0400, Terry Reedy wrote: a bug, bug a limitation due to using limited-range numbers. If one uses residue classes instead of integers, and makes no adjustment, I consider it wrong to blame Bentley. But it was Bentley himself who used the C int type, so it hardly

Re: tough-to-explain Python

2009-07-10 Thread Terry Reedy
I V wrote: On Fri, 10 Jul 2009 16:27:12 -0400, Terry Reedy wrote: a bug, bug a limitation due to using limited-range numbers. If one uses residue classes instead of integers, and makes no adjustment, I consider it wrong to blame Bentley. But it was Bentley himself who used the C int type, so

Re: tough-to-explain Python

2009-07-10 Thread John Nagle
Bearophile wrote: kj, as Piet van Oostrum as said, that's the difference between mutable an immutable. It comes from the procedural nature of Python, and probably an explanation of such topic can't be avoided if you want to learn/teach Python. The problem with Python's mutable/immutable

Re: tough-to-explain Python

2009-07-09 Thread greg
Dave Angel wrote: By the time I graduated, I had five six-level languages ^^^ Are they languages that you have to edit using vi? :-) -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: tough-to-explain Python

2009-07-09 Thread Dave Angel
greg wrote: div class=moz-text-flowed style=font-family: -moz-fixedDave Angel wrote: By the time I graduated, I had five six-level languages ^^^ Are they languages that you have to edit using vi? :-) Back then I didn't need glasses. That was of course

Re: tough-to-explain Python

2009-07-09 Thread Benjamin Kaplan
On Thu, Jul 9, 2009 at 1:05 AM, Simon Formansajmik...@gmail.com wrote: Everyone gets so caught up in programming via languages that you get, well, people trying to teach Computer Programming as if it were only necessary to grok a language, rather than grokking /symbol manipulation/ itself.

Re: tough-to-explain Python

2009-07-09 Thread Steven D'Aprano
On Wed, 08 Jul 2009 22:05:57 -0700, Simon Forman wrote: The core abstractions of [mechanical] computation are just not that complicated. You can teach them to anybody in about a half an hour, drunk. I have. That's *easy*. Anyone can teach the most complicated and abstract principles of any

Re: tough-to-explain Python

2009-07-09 Thread Steven D'Aprano
On Wed, 08 Jul 2009 22:05:57 -0700, Simon Forman wrote: persistent idea out there that programming is a very accessible skill, like cooking or gardening, anyone can do it, and even profit from it, monetarily or otherwise, etc., and to some extent I am Programming is not like any other human

Re: tough-to-explain Python

2009-07-09 Thread J. Cliff Dyer
On Thu, 2009-07-09 at 18:10 +, Steven D'Aprano wrote: If programming is symbol manipulation, then you should remember that the user interface is also symbol manipulation, and it is a MUCH harder problem than databases, sorting, searching, and all the other problems you learn about in

Re: tough-to-explain Python

2009-07-09 Thread Ethan Furman
Steven D'Aprano wrote: There is some evidence that 30-60% of people simply cannot learn to program, no matter how you teach them: http://www.codinghorror.com/blog/archives/000635.html http://www.cs.mdx.ac.uk/research/PhDArea/saeed/ I'm sympathetic to the idea, but not entirely convinced.

Re: The meaning of = (Was: tough-to-explain Python)

2009-07-09 Thread Lawrence D'Oliveiro
In message h3291j$mf...@reader1.panix.com, kj wrote: .., Lundh writes: Assignment statements modify namespaces, not objects. counterexample a = [3] b = a These may indeed modify a namespace, not any object. However: a[:] = [4] a [4] b [4] What change

Re: tough-to-explain Python

2009-07-09 Thread Terry Reedy
Steven D'Aprano wrote: And speaking of binary search: [quote] I was shocked to learn that the binary search program that Bentley PROVED CORRECT and SUBSEQUENTLY TESTED [emphasis added] in Chapter 5 of Programming Pearls contains a bug. Once I tell you what the it is, you will understand why

Re: tough-to-explain Python

2009-07-09 Thread Steven D'Aprano
On Thu, 09 Jul 2009 23:07:34 -0400, Terry Reedy wrote: Steven D'Aprano wrote: And speaking of binary search: [quote] I was shocked to learn that the binary search program that Bentley PROVED CORRECT and SUBSEQUENTLY TESTED [emphasis added] in Chapter 5 of Programming Pearls contains a

Re: tough-to-explain Python

2009-07-08 Thread Steven D'Aprano
On Tue, 07 Jul 2009 20:04:46 +, kj wrote: I'm having a hard time coming up with a reasonable way to explain certain things to programming novices. [...] Or consider this one: ham = [1, 2, 3, 4] spam = (ham,) spam ([1, 2, 3, 4],) spam[0] is ham True spam[0] += [5] Traceback

Re: tough-to-explain Python

2009-07-08 Thread Francesco Bochicchio
On Jul 7, 10:04 pm, kj no.em...@please.post wrote: I'm having a hard time coming up with a reasonable way to explain certain things to programming novices. Consider the following interaction sequence: def eggs(some_int, some_list, some_tuple): ...     some_int += 2 ...     some_list +=

Re: tough-to-explain Python

2009-07-08 Thread Gabriel Genellina
En Wed, 08 Jul 2009 04:32:07 -0300, Francesco Bochicchio bieff...@gmail.com escribió: I would go with something like this: In object oriented programming, the same function or operator can be used to represent different things. This is called overloading. To understand what the

Re: tough-to-explain Python

2009-07-08 Thread Piet van Oostrum
Simon Forman sajmik...@gmail.com (SF) wrote: SF Why would you even tell the poor bastards about += before they were SF comfortable with (python's style of) function calls, immutable SF integers, mutable lists and immutable tuples? SF Let them use x = x + y until they have enough knowledge to SF

Fractions as result from divisions (was: Re: tough-to-explain Python)

2009-07-08 Thread Ulrich Eckhardt
Bearophile wrote: For example a novice wants to see 124 / 38 to return the 62/19 fraction and not 3 or 3.263157894736842 :-) Python has adopted the latter of the three for operator / and the the second one for operator //. I wonder if it was considered to just return a fraction from that

Re: Fractions as result from divisions (was: Re: tough-to-explain Python)

2009-07-08 Thread kj
In c75ei6-e0i@satorlaser.homedns.org Ulrich Eckhardt eckha...@satorlaser.com writes: Bearophile wrote: For example a novice wants to see 124 / 38 to return the 62/19 fraction and not 3 or 3.263157894736842 :-) Python has adopted the latter of the three for operator / and the the second

Re: tough-to-explain Python

2009-07-08 Thread kj
In 5f0a2722-45eb-468c-b6b2-b7bb80ae5...@q11g2000yqi.googlegroups.com Simon Forman sajmik...@gmail.com writes: Frankly, I'm of the impression that it's a mistake not to start teaching programming with /the bit/ and work your way up from there. I'm not kidding. I wrote a (draft) article about

Re: Fractions as result from divisions (was: Re: tough-to-explain Python)

2009-07-08 Thread Steven D'Aprano
On Wed, 08 Jul 2009 11:24:28 +0200, Ulrich Eckhardt wrote: Bearophile wrote: For example a novice wants to see 124 / 38 to return the 62/19 fraction and not 3 or 3.263157894736842 :-) Python has adopted the latter of the three for operator / and the the second one for operator //. Up

Re: tough-to-explain Python

2009-07-08 Thread Steven D'Aprano
On Wed, 08 Jul 2009 12:23:50 +, kj wrote: In 5f0a2722-45eb-468c-b6b2-b7bb80ae5...@q11g2000yqi.googlegroups.com Simon Forman sajmik...@gmail.com writes: Frankly, I'm of the impression that it's a mistake not to start teaching programming with /the bit/ and work your way up from there. I'm

Re: tough-to-explain Python

2009-07-08 Thread kj
In 5f0a2722-45eb-468c-b6b2-b7bb80ae5...@q11g2000yqi.googlegroups.com Simon Forman sajmik...@gmail.com writes: I'm not kidding. I wrote a (draft) article about this: Computer Curriculum http://docs.google.com/View?id=dgwr777r_31g4572gp4 Very cool. kj --

Re: tough-to-explain Python

2009-07-08 Thread Paul Moore
2009/7/8 kj no.em...@please.post: There is this persistent idea out there that programming is a very accessible skill, like cooking or gardening, anyone can do it, and even profit from it, monetarily or otherwise, etc., and to some extent I am actively contributing to this perception by

Re: tough-to-explain Python

2009-07-08 Thread nn
On Jul 7, 5:18 pm, kj no.em...@please.post wrote: In mailman.2796.1246997332.8015.python-l...@python.org Chris Rebert c...@rebertia.com writes: You might find the following helpful (partially): http://effbot.org/zone/call-by-object.htm Extremely helpful.  Thanks!  (I learned more from it

The meaning of = (Was: tough-to-explain Python)

2009-07-08 Thread kj
In h30e3t$g5...@reader1.panix.com kj no.em...@please.post writes: I had not realized how *profoundly* different the meaning of the = in Python's spam = ham is from the = in its spam[3] = ham[3] To clarify, this comes from my reading of Fredrik Lundh's pages Python Objects

Re: The meaning of = (Was: tough-to-explain Python)

2009-07-08 Thread Paul Boddie
On 8 Jul, 16:04, kj no.em...@please.post wrote:   identifier = expression and not to those like, for example,   identifier[expression] = expression or   identifier.identifier = expression The former are syntatic sugar for certain namespace modifications that leave objects unchanged.  

Re: The meaning of = (Was: tough-to-explain Python)

2009-07-08 Thread kj
In 0778f257-d36c-4e13-93ea-bf8d448c8...@b15g2000yqd.googlegroups.com Paul Boddie p...@boddie.org.uk writes: On 8 Jul, 16:04, kj no.em...@please.post wrote: =A0 identifier =3D expression and not to those like, for example, =A0 identifier[expression] =3D expression or =A0

Re: The meaning of = (Was: tough-to-explain Python)

2009-07-08 Thread Aahz
In article 0778f257-d36c-4e13-93ea-bf8d448c8...@b15g2000yqd.googlegroups.com, Paul Boddie p...@boddie.org.uk wrote: Almost. The latter can modify namespaces - the objects themselves - but through properties or dynamic attribute access, they may choose not to modify such a namespace. Really, we

Re: tough-to-explain Python

2009-07-08 Thread Dave Angel
kj wrote: In 5f0a2722-45eb-468c-b6b2-b7bb80ae5...@q11g2000yqi.googlegroups.com Simon Forman sajmik...@gmail.com writes: Frankly, I'm of the impression that it's a mistake not to start teaching programming with /the bit/ and work your way up from there. I'm not kidding. I wrote a (draft)

Re: The meaning of = (Was: tough-to-explain Python)

2009-07-08 Thread Aahz
In article h32eoh$ql...@reader1.panix.com, kj no.em...@please.post wrote: OK, so, scratching from my original post the case identifier.identifier = expression (as being a special case of identifier = expression), still, to the extent that I understand your post, the = in x = 1 means

Re: The meaning of = (Was: tough-to-explain Python)

2009-07-08 Thread kj
In h32fon$26...@panix3.panix.com a...@pythoncraft.com (Aahz) writes: In article h32eoh$ql...@reader1.panix.com, kj no.em...@please.post wrote: OK, so, scratching from my original post the case identifier.identifier = expression (as being a special case of identifier = expression), still, to

Re: The meaning of = (Was: tough-to-explain Python)

2009-07-08 Thread Terry Reedy
kj wrote: To clarify, this comes from my reading of Fredrik Lundh's pages Python Objects (http://effbot.org/zone/python-objects.htm) and Call By Object (http://effbot.org/zone/call-by-object.htm). [snip] [END OF LENGTHY QUOTE] Therefore, extending just a bit beyond Lundh's explanation, if we

Re: tough-to-explain Python

2009-07-08 Thread Simon Forman
(I wanted to reply to a few messages in one post so I quoted them all below. Let me know if this is bad etiquette.) On Jul 8, 8:23 am, kj no.em...@please.post wrote: In 5f0a2722-45eb-468c-b6b2-b7bb80ae5...@q11g2000yqi.googlegroups.com Simon Forman sajmik...@gmail.com writes: Frankly, I'm of

tough-to-explain Python

2009-07-07 Thread kj
I'm having a hard time coming up with a reasonable way to explain certain things to programming novices. Consider the following interaction sequence: def eggs(some_int, some_list, some_tuple): ... some_int += 2 ... some_list += [2] ... some_tuple += (2,) ... x = 42 y = (42,) z

Re: tough-to-explain Python

2009-07-07 Thread Chris Rebert
On Tue, Jul 7, 2009 at 1:04 PM, kjno.em...@please.post wrote: I'm having a hard time coming up with a reasonable way to explain certain things to programming novices. Consider the following interaction sequence: def eggs(some_int, some_list, some_tuple): ...     some_int += 2 ...    

Re: tough-to-explain Python

2009-07-07 Thread Piet van Oostrum
kj no.em...@please.post (k) wrote: k I'm having a hard time coming up with a reasonable way to explain k certain things to programming novices. k Consider the following interaction sequence: def eggs(some_int, some_list, some_tuple): k ... some_int += 2 k ... some_list += [2] k ...

Re: tough-to-explain Python

2009-07-07 Thread kj
In m2my7gb4g6@cs.uu.nl Piet van Oostrum p...@cs.uu.nl writes: kj no.em...@please.post (k) wrote: k I'm having a hard time coming up with a reasonable way to explain k certain things to programming novices. k Consider the following interaction sequence: def eggs(some_int, some_list,

Re: tough-to-explain Python

2009-07-07 Thread kj
In mailman.2796.1246997332.8015.python-l...@python.org Chris Rebert c...@rebertia.com writes: You might find the following helpful (partially): http://effbot.org/zone/call-by-object.htm Extremely helpful. Thanks! (I learned more from it than someone who will teach the stuff would care to

Re: tough-to-explain Python

2009-07-07 Thread Bearophile
kj, as Piet van Oostrum as said, that's the difference between mutable an immutable. It comes from the procedural nature of Python, and probably an explanation of such topic can't be avoided if you want to learn/teach Python. Lot of people think that a language where everything is immutable is

Re: tough-to-explain Python

2009-07-07 Thread norseman
Bearophile wrote: kj, as Piet van Oostrum as said, that's the difference between mutable an immutable. It comes from the procedural nature of Python, and probably an explanation of such topic can't be avoided if you want to learn/teach Python. ...(snip) See you later, bearophile

Re: tough-to-explain Python

2009-07-07 Thread Bret Fledderjohn
I really enjoyed your boxes analogy, from a guy with a trucking background, it makes a lot of sense! -Bret ... The more I delve into OOP the more I liken an 'object' to a box. A box with a shipping manifest. There are big boxes, little boxes, squat boxes and so on. A box can contain corn

Re: tough-to-explain Python

2009-07-07 Thread Ben Finney
kj no.em...@please.post writes: In mailman.2796.1246997332.8015.python-l...@python.org Chris Rebert c...@rebertia.com writes: You might find the following helpful (partially): http://effbot.org/zone/call-by-object.htm Extremely helpful. Thanks! (I learned more from it than someone

Re: tough-to-explain Python

2009-07-07 Thread John Yeung
On Jul 7, 5:11 pm, kj no.em...@please.post wrote: I don't plan to present these examples to them. But beginners have a way of bumping into such conundrums all on their own [...].  I doubt that an answer of the form don't worry your pretty little head over this now; wait until your second

Re: tough-to-explain Python

2009-07-07 Thread John Yeung
On Jul 7, 8:06 pm, Ben Finney ben+pyt...@benfinney.id.au wrote: I have got very good results from teaching using the analogy of “paper tags tied to physical objects” to describe Python's references to values. Ah, I like that! I think it's better than what I used in my post (which I composed

Re: tough-to-explain Python

2009-07-07 Thread Steven D'Aprano
On Tue, 07 Jul 2009 21:18:53 +, kj wrote: I had not realized how *profoundly* different the meaning of the = in Python's spam = ham is from the = in its spam[3] = ham[3] So much for explicit is better than implicit... I'm sorry, I don't get it. Can you explain please? I

Re: tough-to-explain Python

2009-07-07 Thread python
Ben, I have got very good results from teaching using the analogy of paper tags tied to physical objects to describe Python's references to values. Great analogy!! And an excellent analogy for newcomers to Python. (this would have saved me some personal pain in my early days). Regards,

Re: tough-to-explain Python

2009-07-07 Thread Gabriel Genellina
En Tue, 07 Jul 2009 17:04:46 -0300, kj no.em...@please.post escribió: I'm having a hard time coming up with a reasonable way to explain certain things to programming novices. ham = [1, 2, 3, 4] spam = (ham,) spam ([1, 2, 3, 4],) spam[0] is ham True spam[0] += [5] Traceback (most recent

Re: tough-to-explain Python

2009-07-07 Thread Simon Forman
On Jul 7, 4:04 pm, kj no.em...@please.post wrote: I'm having a hard time coming up with a reasonable way to explain certain things to programming novices. Consider the following interaction sequence: def eggs(some_int, some_list, some_tuple): ... some_int += 2 ... some_list +=