This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients gvanrossum, rhettinger, serhiy.storchaka, terry.reedy, xtreak
Date 2018-10-22.19:26:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1540236414.1.0.788709270274.issue34856@psf.upfronthosting.co.za>
In-reply-to
Content
My understanding of the current code is that in the example above, f.__name__ would be "<lambda x, y=1: x + y>".

1. I believe this would make the representation
 <<lambda x, y=1: x + y> at 0x........>
unless functions gain a custom __repr__ method that strips the brackets off the name when present.  I don't really like the alternative of leaving the brackets off the name.

2. My proposal is to limit the length of the .__name__ attribute.  This not only limits the repr but also the function name part of traceback lines.  I consider the latter more important as I personally see function names in tracebacks far more often than in representations. Long function names wrapped to several lines would in my opinion negatively affect tracebacks.  Large collections do not affect tracebacks.
History
Date User Action Args
2018-10-22 19:26:54terry.reedysetrecipients: + terry.reedy, gvanrossum, rhettinger, serhiy.storchaka, xtreak
2018-10-22 19:26:54terry.reedysetmessageid: <1540236414.1.0.788709270274.issue34856@psf.upfronthosting.co.za>
2018-10-22 19:26:54terry.reedylinkissue34856 messages
2018-10-22 19:26:54terry.reedycreate