# Revision history [back]

### Acess bracked elements in free lie algebra element?

I'm trying to access the left and right elements in a free lie algebra element, whose monomials are stored as binary trees. Thus I want a method (like exists in the source for lie_algebra_element) which would return something like

sage:  L = LieAlgebra(QQ, 3, 'x')
sage: x0,x1,x2 = L.gens()
sage: Lyn = FL.Lyndon()
[[x0, x1], x1]
sage: a._left
[x0,x1]
sage: a._right
x1


Of course the last 4 lines are fake. One way of seeing this is the following:

sage: isinstance(a, LyndonBracket)
False
sage: isinstance(a, LieBracket)
False


How do I fix this "the right way" ? My current solution is just to set

sage: a_tree = eval(repr(a)); a_tree
[[x0, x1], x1]


But this feels extremely wrong.