[Python-Dev] PEP 276 (simple iterator for ints)

Andrew Koenig ark at acm.org
Wed Jun 30 11:44:49 EDT 2004

I happened to look at PEP 276 and was struck by the thought that PEP 276 is
really an implementation of the well-known set-theoretic construction of the
natural numbers that defines each natural number as the set of all smaller
ones.  In other words, it defines 0 as the empty set, 1 as the set whose
only element is 0, 2 as the set whose elements are 0 and 1, and so on.

Indeed, under PEP 276, sets.Set(42) would be a set with 42 elements that
would be exactly the canonical representation of 42.

More information about the Python-Dev mailing list