Skip to content

Conversation

gvx
Copy link
Contributor

@gvx gvx commented Oct 5, 2025

Content.__radd__ does not currently behave as expected. For example:

>>> from textual.content import Content
>>> Content('foo') + 'bar'  # works as expected
Content('foobar')
>>> 'foo' + Content('bar') # expected: Content('foobar')
Content('barfoo')

The problem is that Content.__radd__ (which implements other + self) returns self + other, which is incorrect for concatenation. This pull requests fixes that and adds tests for it. (Existing tests only test for the empty string, for which a + b == b + a happens to hold, unlike most strings.)

@willmcgugan
Copy link
Member

thanks

@willmcgugan willmcgugan merged commit f1c6bec into Textualize:main Oct 11, 2025
22 checks passed
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 this pull request may close these issues.

2 participants