python for loop
Arnaud Delobelle
arnodel at googlemail.com
Thu Apr 2 04:36:25 EDT 2009
Steven D'Aprano wrote:
> In set theory, you start by defining the integers like this:
>
> 0 is the cardinality (size) of the empty set, the set with nothing in it.
>
> 1 is the cardinality of the set of empty sets, that is, the set
> containing nothing but the empty set.
>
> 2 is the cardinality of the set of the empty set plus the set of empty
> sets.
>
> 3 is the cardinality of the set containing the empty set, plus the set of
> empty sets, plus the set of (the empty set plus the set of empty sets).
>
> And so forth, to infinity and beyond.
>
> Or to put it another way:
>
>
> 0 = len( {} )
> 1 = len( {{}} )
> 2 = len( {{}, {{}}} )
> 3 = len( {{}, {{}}, {{}, {{}}} )
FWIW this is the way I learnt it AFAIK:
Ordinals
=======
0 *is* the empty set
1 *is* the the the singleton composed of the empty set, i.e. {0}
2 *is* the set {0, 1}
3 *is* the set {0, 1, 2}
...
n + 1 := n U {n}
It's nice because:
* the interval [0, n) is just the number n
* n < m iff n is a subset of m iff n is a member of m
Cardinals
=========
A cardinal is an equivalence class under the equivalence relation S ~
S' iff there is a bijection between S and S'. Obviously, finite
cardinals contain only one ordinal so finite cardinals can be
identified with their ordinal representative.
--
Arnaud
More information about the Python-list
mailing list