Update treap.py - #1358
Update treap.py#1358
Conversation
check merge()
cclauss
left a comment
There was a problem hiding this comment.
I think it would be easier to understand these changes if you could create a separate PR that added doctests to the current code. Once we have test in place, we can ensure that these changes do not break things. See CONTRIBUTING.md for details.
There was a problem hiding this comment.
This extra indentation is not recommended by https://www.python.org/dev/peps/pep-0257/#multi-line-docstrings
| """ | ||
| root.r, r = split(root.r, key) | ||
| return (root, r) | ||
| if key < root.key: |
There was a problem hiding this comment.
This indentation after a return statement makes this unreachable code. If you are using TABS for indentation then please stop. If you are using four spaces for indentation then please explain why this change is useful.
There was a problem hiding this comment.
return is deleted...
There was a problem hiding this comment.
Put two blank lines between functions or better yet, reformat with black.
random() is used. its difficult to write doctests l->left r->right key->value add __repr__ and __str__ in preorder
* Update treap.py check merge() * Update treap.py random() is used. its difficult to write doctests l->left r->right key->value add __repr__ and __str__ in preorder

check merge()