Nir Soffer has posted comments on this change. Change subject: debuging: Use __repr__ instead of __str__ ......................................................................
Patch Set 1: Francesco, I also read the python docs and used __str__ for years, but if you check python implementation (e.g. threading.py threadmodule.c), you will find that Python it self use __repr__ for this purpose, and the idea of "close the valid python code" is just a lie. This idea cannot work in practice for user objects. We should move to __repr__ for debug output and this patch move most of the code to __repr__. There are only few instance left that need more work to keep the output consistent (e.g. <name properties... at address>). __str__ should be used when we want a nice string, for example, exceptions. __repr__ for showing the internal details of some object. Most object need only __repr__, some objects may need both or only __str__. -- To view, visit https://gerrit.ovirt.org/48865 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2fd724e32dfde1ca484343730f2e55c37a59fdf3 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer <nsof...@redhat.com> Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com> Gerrit-Reviewer: Francesco Romani <from...@redhat.com> Gerrit-Reviewer: Ido Barkan <ibar...@redhat.com> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Milan Zamazal <mzama...@redhat.com> Gerrit-Reviewer: Nir Soffer <nsof...@redhat.com> Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczew...@gmail.com> Gerrit-Reviewer: gerrit-hooks <automat...@ovirt.org> Gerrit-HasComments: No _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches