Slice confusion : a[n:p] is a list exclude the last element p

andrew cooke andrew at acooke.org
Mon Apr 28 15:40:07 EDT 2003


claird at lairds.com said:

> In article <mailman.1051548461.3290.python-list at python.org>,
> andrew cooke <andrew at acooke.org> wrote:
[...]
>>[1,4)+[4,7) = [1,7)
>>
>>isn't there some (fairly old) popular math book by a famousish person
>>(knuth?  hofstadter?) that develops maths (at least arithmetic) based on
>>defining sets of points from the "number line"?  i wonder what that says
>>about this?  (i should admit that i picked up the above from one of
>>celko's db books).
[...]
> So:  there are several relatively popular mathematically-oriented
> books that illustrate, for example, Peano arithmetic.

i'm pretty sure that it specifically mentioned "the number line".  it
could have been a pamphlet rather than a book (i have a curiously clear
memory of reading it in a library at college (dusty and with shelves made
from that meccano-like metal stuff) - possibly the library at the dept of
app maths & theoretical physics, although i have no idea why i'd have been
there (i was a physicist (and not a very theoretical one), not a
mathematician)).  it was pretty old then (15 years ago).

(another example of doing this kind of thing is modelling (to use the
correct term - thank you!) natural numbers as functions in lambda calculus
which must be the most repeated and most boring example in functional
programming textbooks...)

now i need to go and google for peano arithmetic :o)

cheers,
andrew

-- 
http://www.acooke.org/andrew





More information about the Python-list mailing list