[issue2610] string representation of range

Brad Miller report at bugs.python.org
Fri Apr 11 18:06:26 CEST 2008


Brad Miller <bonelake at gmail.com> added the comment:

Our use of range in the first few classes is exactly for iteration 
purposes, but I do not like students to have to have too many mysteries.  
So I always have liked to show that range(10) simply produces a sequence 
of integers.  In Python 3.0 range returns a mysterious iteration object.  
No thanks.  My proposal was to provide a more user friendly 
implementation of the str method for this new range object that would 
allow the user to see the sequence.  I like Python because it is so easy 
to start up a shell and poke around and see what things are.

I have no problem, introducing list(range(10)) in week 3 when I start 
talking about lists, and I like list comprehensions of that purpose too.

Again, what I do not like is that things that used to be very easy for 
students to get a conceptual handle on are now more difficult in 3.0.
- range is one example the dict_keys and dict_values objects are another 
example.  dict_keys et. al. are much easier to deal with since I've 
already covered lists and the list() function by the time I get there.

BTW, I think  we must have very different teaching styles as I would 
never introduce something as mysterious as list(_) on the first day of 
class.  I'd be happy to continue our discussion of teaching philosophy 
but I doubt that this is the right forum.

Brad

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2610>
__________________________________


More information about the Python-bugs-list mailing list