Yo,
> It is perfectly valid for a method to raise an error if the current instance
> does not meet certain criteria. I feel a double standard here with
> multiedges and loops...
If you consider it my responsibility to write, fix and manage the
loops/mutiedges code for graphs we have a problem. It is something
that YOU use and that I must manage ? Funny. Let me, and loops and
multiedges are gone from Sage tomorrow.
>> - Mathematically speaking, this method cannot even be *defined* on the
>> object to which it belongs (the order does not always exist)
>
> It has a perfectly valid and useful definition with a very mild assumption.
Most functions of this class that are not broken (contrary to
.base_ring, N, subs, ...) make this assumption. The class itself
should be changed. Even functions which *should* work (because of this
order) fail because the permutation contains zero:
sage: SetPartition([[0,1,2],[3,4]]).to_permutation()
...
ValueError: All elements should be strictly positive integers, and
I just found a negative one.
What you see is the result of long and careless programming: nobody
cared to check the assumptions of the functions they write, *AND* they
were all convinced that the functions only meant to handle the object
that they have in mind, i.e. SetPartition on 1,...,n.
You cannot "fix it" by adding some doc (even if you actually end up
doing it). You need to actively check the assumptions that the
functions make, or declare once and for all that this class is only
meant to handle the kind of input that Permutation does (1- indexed
again. Seriously ...).
> I don't mind adding a *little* warning to the doc.
Think of the users.
> BTW, the only messages complaining about this I've seen is from you.
Theorem: When the first person complains, he is the only one to complain.
Nathann