The simplest repr implementation would probably be something like:
{{{
def __repr__(self):
return '{obj.__class__!r} {obj!s}'.format(obj=self)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/22531>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/22531#comment:1>
Comment (by mardini):
PR: https://github.com/django/django/pull/2628
--
Ticket URL: <https://code.djangoproject.com/ticket/22531#comment:2>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"393ddc10a78354b573b9e746247df013f7bd6151"]:
{{{
#!CommitTicketReference repository=""
revision="393ddc10a78354b573b9e746247df013f7bd6151"
Fixed #22531 -- Added tree.Node.__repr__ and tests for the class.
While Node class has a useful `__str__`, its `__repr__` is not that
useful. Added a `__repr__` that makes use of the current `__str__`.
This is especially useful since the more popular `Q` class inherits
`tree.Node`. Also created new tests that cover most of `Node` class
functionality.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/22531#comment:3>