<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On 22 Dec. 2017 12:32 pm, "Chris Angelico" <<a href="mailto:rosuav@gmail.com">rosuav@gmail.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text">On Fri, Dec 22, 2017 at 9:43 AM, Chris Barker <<a href="mailto:chris.barker@noaa.gov">chris.barker@noaa.gov</a>> wrote:<br>
> Every python object has an object identity, and the way to get it is with<br>
> the id() function. The id is also part of the default object repr, but given<br>
> that some, but only some objects have the id in their repr, it's probably<br>
> better to use id() in you logs if you care.<br>
><br>
> And in the case of lambda, wouldn't you rather see what the lambda actually<br>
> WAS than what it's id is?<br>
><br>
> Is there any downside other than backward compatibility concerns?<br>
<br>
</div>It's probably worth hanging onto the id, in case the same function<br>
(from the same line of code) is used in multiple contexts. But IMO<br>
having the text of the function would be very useful - as long as it<br>
can be done without costing too much time or memory. So I'm +0.75 on<br>
the idea, with the caveat that it'd have to be implemented and<br>
performance-tested to make sure it doesn't kill the common case of a<br>
lambda function being created, used, and then dropped (think of a sort<br>
key function, for instance).<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">Having the repr report the defining module name & line number in addition to the object ID could be a low cost way of making the definition easier to find without adding any overhead in the common case.</div><div dir="auto"><br></div><div dir="auto">Cheers,</div><div dir="auto">Nick.</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
ChrisA<br>
<div class="elided-text">______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/<wbr>codeofconduct/</a><br>
</div></blockquote></div><br></div></div></div>