[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-list
Subject:    Re: Teaching the "range" function in Python 3
From:       Terry Reedy <tjreedy () udel ! edu>
Date:       2017-06-30 20:22:05
Message-ID: oj6bt8$249$1 () blaine ! gmane ! org
[Download RAW message or body]

On 6/30/2017 1:07 PM, Irv Kalb wrote:

> Thanks to everyone who responded to my question about teaching the range function.

range is a class, not a function in the strict sense.

Classes represent concepts.  Instances of classes represent instances of 
the concept. Range represent the concept 'arithmetic sequence', a 
sequence of numbers with a constant difference.  To form an arithmetic 
sequence, start with a number and keep adding a constant.

Surely, schoolkids still have experience doing this, counting up or down 
by a number: 0,3,6,9,12,15...; 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 
'liftoff'; 99 bottles of beer. Counting down from 100 by a larger number 
is an old challenge.  100, 97, 94, 91, 88/

> I particularly like the ideas of using the words "collection" and "sequence"- those \
> seem to be very clear. 
> In my curriculum, I first go through a in detail discussion of the need for, the \
> syntax of and the usage of lists.

'list' represents the more general concept 'mutable sequence of 
arbitrary information objects'.

-- 
Terry Jan Reedy

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic