Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different behaviour between RenderTree(root) and RenderTree(root).by_attr(lambda x: x) #191

Closed
epistoteles opened this issue Feb 15, 2022 · 0 comments
Assignees

Comments

@epistoteles
Copy link

I have a custom Comment class inheriting from NodeMixin.
This class has a custom __repr__ implementation producing a string with two newline characters:

def __repr__(self):
    return f"▲ {self.score} {italic(self.author)}\n{color(blocked(underline(self.title)), c='yellow')}\n{color(blocked(self.body), c='yellow')}"

When I print the root node using print(RenderTree(root)) I get the following (undesired) output:

Screenshot from 2022-02-14 20-24-42

However, when I print the root node using print(RenderTree(root).by_attr(lambda x: x)) I get the following (desired) output:

Screenshot from 2022-02-14 20-24-23

The lambda function should not have any effect. Why do the two outputs look different?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants