Skip to content

The 'copy()' method does not work properly on subclasses of IntervalTree #147

Open
@wolkiewiczk

Description

@wolkiewiczk

As in the title. It always returns IntervalTree instance instead of the subclass instance.

In [1]: from intervaltree import IntervalTree

In [2]: class MyTree(IntervalTree):
   ...:     pass
   ...: 

In [3]: t = MyTree()

In [4]: isinstance(t.copy(), MyTree)
Out[4]: False

In [5]: type(t.copy())
Out[5]: intervaltree.intervaltree.IntervalTree

The same applies to other methods that return a new IntervalTree, like intersection, union... Also __repr__ always prints IntervalTree.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions