<div dir="ltr"></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 29, 2017 at 12:30 PM, Ethan Furman <span dir="ltr"><<a href="mailto:ethan@stoneleaf.us" target="_blank">ethan@stoneleaf.us</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 12/29/2017 11:55 AM, Ethan Smith wrote:<span class=""><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Fri, Dec 29, 2017 at 11:37 AM, Ethan Furman wrote:<br>
</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
It is possible to determine whether an existing __repr__ is from 'object'<br>
</blockquote></blockquote>
>> or not, and only provide one if that is the case. I think that should be<br>
>> the default, with 'repr = True' for those cases where a new, auto-generated,<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
__repr__ is desired.<br>
</blockquote>
<br>
The only other thing you'd want to handle is to cover inheriting from another dataclass. e.g., if I have dataclass with<br>
attribute a, and subclass it to add attribute b, I'd want both in the repr.<br>
</blockquote>
<br></span>
Good point. So auto-generate a new __repr__ if:<br>
<br>
- one is not provided, and<br>
- existing __repr__ is either:<br>
 - object.__repr__, or<br>
 - a previous dataclass __repr__<br>
<br>
And if the auto default doesn't work for one's use-case, use the keyword parameter to specify what you want.<div class="HOEnZb"><div class="h5"><br>
<br>
--<br>
~Ethan~<br>
______________________________<wbr>_________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org" target="_blank">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/ethan%40ethanhs.me" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/options/python-dev/ethan%<wbr>40ethanhs.me</a><br>
</div></div></blockquote></div><br></div>