Agreed! In fact, looking at the docstring, it seems like "rank" is just an 
alias for "index". Of course, "index" is going to be a similarly overloaded 
term, but at least "rank" can be freed up by just dropping it as an alias 
of "index". You can then solve the problems of "index" separately.

For "unrank" (which according to the doc should give the position of an 
element in the enumeration) you could use "ordinal" instead, but "unrank" 
is such an ugly word that I don't think you'll run into many clashes for 
that one.

On Tuesday, 19 August 2025 at 07:33:03 UTC-7 axio...@yahoo.de wrote:

> Dear all,
>
> in the category for `EnumeratedSets` we have methods `rank` and `unrank` 
> that provide a bijection between the set and the natural numbers (or some 
> interval [0,n], if the cardinality is n).  These methods are mostly used in 
> the category framework, I think, to provide generic implementations of 
> `random_element` and the like.
>
> Unfortunately, this conflicts with the method `rank` in Posets and 
> WeylGroups, as I realized while adding a test_rank method (which in turn 
> uncovered quite a few bugs).
>
> Even though `rank` and `unrank` were introduced very early in the game, I 
> think it would make sense to rename them to something less confusing and 
> deprecate them.  I don't think they are used much by users.   For example, 
> I think `total_order_rank` and `total_order_unrank` would be OK.
>
> I don't think it is wise to rename `Poset.rank` or `WeylGroup.rank`, 
> because these are really extremely standard.  We do have 
> `StandardTableau.standard_descents` 
> and `StandardTableau.standard_major_index`, because of an historical 
> accident, and I think it's a pain.  However, if very many people think it 
> is better to do `Poset.standard_rank`, than this would also be an option.
>
> I am also open to other suggestions, but I really think that these methods 
> should be tested systematically.
>
> Martin
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/sage-devel/c97ab592-3a65-4fa9-8dc4-34b8176585b9n%40googlegroups.com.

Reply via email to