python for loop
mail at johnohagan.com
Thu Apr 2 10:09:16 CEST 2009
On Thu, 2 Apr 2009, Steven D'Aprano wrote:
> On Thu, 02 Apr 2009 04:23:32 +0000, John O'Hagan wrote:
> > Beyond being part of a conventionally-ordered set of keys, what can an
> > ordinality of zero actually mean? (That's a sincere question.)
[snip erudite definition of cardinality]
> For non-infinite sets, you can treat ordinal numbers and cardinal numbers
> as more or less identical. So an ordinality of zero just means the number
> of elements of something that doesn't exist.
This is the bit I don't get - I had thought of ordinality as something
attached to each item - ['a','b','c'] has a cardinality of 3, and elements of
ordinality 1, 2 and 3 (first,second, third) respectively. So it's possible to
have a cardinality of zero (an empty sequence does) but only "something that
doesn't exist" can have an ordinality of zero; as soon as there is an item,
its ordinality is 1. Shoot me down, please!
> How that relates to whether indexing should start at one or zero, I have
> no idea.
Only insofar as the "weirdness" of indexing being out of step with
ordinality/cardinality matters, i.e. not that much. :)
More information about the Python-list