On 8/10/2014 2:14 PM, Roy Smith wrote:
In article <154cc342-7f85-4d16-b636-a1a953913...@googlegroups.com>,
  Rustom Mody <rustompm...@gmail.com> wrote:

l= [6,2,9,12,1,4]
sorted(l,reverse=True)[:5]
[12, 9, 6, 4, 2]

No need to know how sorted works nor [:5]

Now you (or Steven) can call it abstract.

And yet its
1. Actual running code in the interpreter
2. Its as close as one can get to a literal translation of your
    "Find the 5 largest numbers in a list"
[...]
All the above are clearer than loops+assignments and can be
taught before them

I disagree.  For a beginner, you want to be able to break things down
into individual steps and examine the result at each point.  If you do:

l= [6,2,9,12,1,4]
l2 = sorted(l,reverse=True)

you have the advantage that you can stop after creating l2 and print it
out.  The student can see that it has indeed been sorted.  With the
chained operations, you have to build a mental image of an anonymous,
temporary list, and then perform the slicing operation on that.  Sure,
it's the way you or I would write it in production code, but for a
beginner, breaking it down into smaller pieces makes it easier to
understand.

l2[:5]

Yes, and that teaching technique is supported by research.

Beginners are particularly poor, in relation to experts, at noticing the applicability of idea, and at combining ideas together. Breaking things into component parts has multiple benefits:

1. The applicability of individual ideas becomes obvious. It's one thing to know about [].sort, and another thing to know when it's appropriate to sort something.

2. The expert specifically shows how and why the ideas are combined. This helps build the connection for the beginner, whose knowledge is not stored as an expert stores it; i.e, in broad categories with multiple connections; but as disorganized data with very few connections.

http://www.amazon.com/How-Learning-Works-Research-Based-Principles/dp/0470484101

I bought the book based on a recommendation from SciPy talk, and it's really great. As an autodidact, it'll help me teach *myself* better, too.

--
Neil Cerutti

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to