Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The reason for observed behavior is that the elements of Arrangements are not lists but

<class 'sage.combinat.permutation.arrangements_msetk_with_category.element_class'="">

and so they cannot be equal to lists even if the content is the same.

A simple fix is to perform conversion into a list in the removal call:

newL=removeFromList(list(equiv[0]),upAndRightSidesL)

Btw, your removeFromList function is an overkill - it can be done in a single line using list comprehension:

def removeFromList(el,L) :
    return [e for e in L if e!=el]

The reason for observed behavior is that the elements of Arrangements are not lists but

<class 'sage.combinat.permutation.arrangements_msetk_with_category.element_class'="">

'sage.combinat.permutation.Arrangements_msetk_with_category.element_class'>

and so they cannot be equal to lists even if the content is the same.

A simple fix is to perform conversion into a list in the removal call:

newL=removeFromList(list(equiv[0]),upAndRightSidesL)

Btw, your removeFromList function is an overkill - it can be done in a single line using list comprehension:

def removeFromList(el,L) :
    return [e for e in L if e!=el]

The reason for the observed behavior is that the elements of Arrangements are not lists but

<class 'sage.combinat.permutation.Arrangements_msetk_with_category.element_class'>

and so they cannot be equal to lists even if the content is the same.

A simple fix is to perform conversion into a list in the removal call:

newL=removeFromList(list(equiv[0]),upAndRightSidesL)

Btw, your removeFromList function is an overkill - it can be done in a single line using list comprehension:

def removeFromList(el,L) :
    return [e for e in L if e!=el]