I want to extend the nltk.tree class i.e. :
class XTree(Tree):
......
What I want is to "cast" this return value to my XTree class, because I don't have control over methods that return Tree objects, so that I can use the additional methods I have in XTree.
I know I can not cast in python, but how would I do what I want ? m'I missing something trivial
After some research I found that there is class method Tree.convert() which does exactly that :)
https://www.nltk.org/_modules/nltk/tree
Anyway it is interesting if there is general solution to the question.