Hi Trevor,
   Right...I remember coming across this problem before. Since I know this 
class is for internal use (simply to index a basis), we can override 
__call__() instead of _element_constructor_() as we do not need to invoke 
the coercion framework (and we want this to be fast). This is what the 
subsets code does too.

Best,
Travis


On Tuesday, June 21, 2022 at 1:20:07 AM UTC+9 Trevor Karn wrote:

> Hi all,
>
> I am trying to implement a Parent in the category of 
> FiniteEnumeratedSets().Facade(). My hope was to have the finite enumerated 
> sets be represented by `Bitset 
> <https://doc.sagemath.org/html/en/reference/data_structures/sage/data_structures/bitset.html#sage.data_structures.bitset.Bitset>`s.
>  
> Upon testing, I get the error: TypeError: Cannot convert 
> sage.data_structures.bitset.Bitset to sage.structure.element.Element. I 
> also get the same error when I set facade=True in the Parent.__init__ call. 
> I think this behavior makes sense because (as I understand it) the facade 
> elements should be elements of *some* parent, just not the parent `self`. 
> On the other hand, Bitsets are not an element of any parent.
>
> Does anyone have advice on how to proceed? I can think of a few options:
>
> - Make Bitsets an Element. This doesn't seem desirable because Bitsets is 
> Cythonized, and as I understand it, Cython doesn't play nice with the 
> Parent/Element framework (please correct me if I misunderstand).
>
> - Make an Element class for my Parent which inherits from both element and 
> Bitset. This doesn't seem desirable because I want my parent to be in 
> FiniteEnumeratedSets().Facade().
>
> I don't like either of those options, does anyone have suggestions on what 
> else I could do?
>
> Thanks so much!
>
> -Trevor
>
>
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/sage-devel/5646a2cb-22d5-43bb-bcbd-b92b0119fb00n%40googlegroups.com.

Reply via email to