Enumerating all 3-tuples (Posting On Python-List Prohibited)

Ben Bacarisse ben.usenet at bsb.me.uk
Mon Mar 12 20:58:36 EDT 2018


Lawrence D’Oliveiro <lawrencedo99 at gmail.com> writes:

> On Sunday, March 11, 2018 at 2:40:16 PM UTC+13, Ben Bacarisse wrote:
>> It would be nice to avoid relying on any value-based ordering.
>
> I don’t see why. The set of elements has to have the same cardinality
> as the set of natural numbers, after all. Why not take advantage of
> that?

Maybe we are saying the same thing?  The elements from which the tuple
members are drawn need only be a sequence defined by a successor
function.  The values themselves need have no ordering nor, indeed, have
any of the arithmetic properties of N.

Of course you can always generate n-tuples of N and then map these to
n-tuples of the intended sequence but that seems inelegant.

-- 
Ben.



More information about the Python-list mailing list