Hi Nathann, This is one very special case where the Parent/Element relation is broken. First of all FiniteEnumeratedSet is not the parent of its elements (it is a facade):
sage: F = FiniteEnumeratedSet([1, Partition([2,1]), Permutation([3,2,1])]) sage: F {1, [2, 1], [3, 2, 1]} sage: F[0].parent() Integer Ring sage: F[1].parent() Partitions sage: F[2].parent() Standard permutations FiniteEnumeratedSet is aimed to not modify the input it gets. So if you feed it with Python objects which are not elements it will not complain and you have to go with that. With Stepan we implemented a TotallyOrderedFiniteSet which has an option for having the behaviour you expected sage: T = TotallyOrderedFiniteSet([1, Partition([2,1]), Permutation([3,2,1])], facade=False) sage: T[0] 1 sage: T[0].parent() {1, [2, 1], [3, 2, 1]} Cheers, Vincent 2014-04-30 9:02 UTC+02:00, Nathann Cohen <nathann.co...@gmail.com>: > Here is the problem I met today: > > sage: F = FiniteEnumeratedSet(("a","b","c")); F > {'a', 'b', 'c'} > sage: isinstance(F,Parent) > True > sage: F[0] > 'a' > sage: F[0].parent() > --------------------------------------------------------------------------- > AttributeError Traceback (most recent call last) > <ipython-input-15-142f29211c68> in <module>() > ----> 1 F[Integer(0)].parent() > > AttributeError: 'str' object has no attribute 'parent' > > Soooooooo sometimes you write code that applies to parents, and sometimes > the elements know what their parents are, sometimes they don't.... > > 1) Is that normal ? > 2) If not, what do we do against it ? > > Have fun ! > > Nathann > > -- > You received this message because you are subscribed to the Google Groups > "sage-combinat-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-combinat-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-combinat-devel@googlegroups.com. > Visit this group at http://groups.google.com/group/sage-combinat-devel. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-combinat-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-combinat-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-combinat-devel. For more options, visit https://groups.google.com/d/optout.