[Edu-sig] Re: In defense of 0, was Re: None potato, one potato,
two potato, more..
Trent Oliphant
trent at oliphant.org
Mon Jan 5 13:22:21 EST 2004
>
>>So the indexing notation [n] could be considered shorthand for [n:n+1]?
>> You are taking a slice of len 1 starting at n?
>
>
> But where [n:n+1] is a sequence of length 1, [n] is the object in that
> sequence.
>
> >>> x = ['a', 'b', 'c', 'd']
> >>> x[2:3]
> ['c']
> >>> x[2]
> 'c'
>
> If Python had a 'first' method for sequences, similar to 'car' in
> Lisp, then x[n] would be roughly equivalent to x[n:n+1].first().
>
Of course you are correct that they are not truly equivalent. That is
the problem with any model - at some point it breaks down. I know that
I have a tendency to create models that work for me to understand - and
then I know the limitation of the model. Isn't that one of the
challenges of teaching - finding a common ground for understanding?
Trent
More information about the Edu-sig
mailing list