Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Add co_arm_length method to Sage partitions

There is a method arm_length(i,j) which returns the arm length of the partition. I couldn't find a corresponding co-arm method, and for the sake of consistency, I'd like it implemented as a method. So I tried to make a derived class for Sage's partitions. To find out their original class, I tried this in my notebook:

print(type(Partition([5,4,4,1])))

which returns

<class 'sage.combinat.partition.Partitions_all_with_category.element_class'>

I think this means that the underlying class is sage.combinat.partition.Partitions_all_with_category.element_class

Now I try to write a class which takes the above as input, and Sage complains, saying

AttributeError: module 'sage.combinat.partition' has no attribute 'Partitions_all_with_category'

I cannot make any sense of this. I do not necessarily need an explanation for what's going on, but I'd like to find a way to implement co_arm_length() so that it looks exactly the same as arm_length() for partitions. Otherwise my code is going to get too unclean for me to read.

Add co_arm_length method to Sage partitions

There is a method arm_length(i,j) which returns the arm length of the partition. I couldn't find a corresponding co-arm method, and for the sake of consistency, I'd like it implemented as a method. So I tried to make a derived class for Sage's partitions. To find out their original class, I tried this in my notebook:

print(type(Partition([5,4,4,1])))

which returns

<class 'sage.combinat.partition.Partitions_all_with_category.element_class'>

I think this means that the underlying class is sage.combinat.partition.Partitions_all_with_category.element_class

Now I try to write a class which takes the above as input, and Sage complains, saying

AttributeError: module 'sage.combinat.partition' has no attribute 'Partitions_all_with_category'

I cannot make any sense of this. I do not necessarily need an explanation for what's going on, but I'd like to find a way to implement co_arm_length() so that it looks exactly the same as arm_length() for partitions. Otherwise my code is going to get too unclean for me to read.

Add co_arm_length method to Sage partitions

There is a method arm_length(i,j) which returns the arm length of the partition. I couldn't find a corresponding co-arm method, and for the sake of consistency, I'd like it implemented as a method. So I tried to make a derived class for Sage's partitions. To find out their original class, I tried this in my notebook:

print(type(Partition([5,4,4,1])))

which returns

<class 'sage.combinat.partition.Partitions_all_with_category.element_class'>

I think this means that the underlying class is sage.combinat.partition.Partitions_all_with_category.element_class

Now I try to write a class which takes the above as input, and Sage complains, saying

AttributeError: module 'sage.combinat.partition' has no attribute 'Partitions_all_with_category'

I cannot make any sense of this. I do not necessarily need an explanation for what's going on, but I'd like to find a way to implement co_arm_length() so that it looks exactly the same as arm_length() for partitions. Otherwise my code is going to get too unclean for me to read.