On Thu, 2009-04-02 at 06:28 +0000, Steven D'Aprano wrote:
> In set theory, you start by defining the integers like this:
<snip>
> 
> 0 = len( {} )
> 1 = len( {{}} )
> 2 = len( {{}, {{}}} )
> 3 = len( {{}, {{}}, {{}, {{}}} )
> etc.
not quite len() - surely you mean something like "any object along with
an algebra in which the left hand side is equivalent to the right in the
algebra of set theory?" - at least for ordinals.

The cardinal is then (for finite numbers) the length of that.


Or, in a pythonic sense (taking 0,1,2,... to be variable names):
 0 = set()
 1 = set(0)
 2 = set(1,0)
 3 = set(2,1,0)
 3 = set(3,2,1,0)
 etc.


> How that relates to whether indexing should start at one or zero, I
> have 
> no idea.

so in this sense, range(n) is actually very close to the ordinal value
of 0 (except for being a list and not a set - but it's not in 3.0)

i.e. range(n) returns something very similar to the ordinal "n", and
with cardinality n. That seems very sensible to me.


> Oh, and speaking of... I'm shocked, SHOCKED I say, that nobody has
> given that quote about the compromise of 0.5.
"God made the integers, all else is the work of man" - Leopold Kronecker

...holding myself back from complaining about integer division in Py3K
when the philosophical question of whether irrational numbers even exist
(in a physics sense) is fairly open.

Tim W


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

Reply via email to