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 Isaac Morland
Recipients Isaac Morland, ethan.furman, rhettinger, steven.daprano
Date 2017-07-31.12:28:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1501504103.48.0.228111534121.issue31085@psf.upfronthosting.co.za>
In-reply-to
Content
I want a meaningful name to appear in debugging output generated by repr() or str(), not just _ all over the place.  I just don't want to specifically come up with the meaningful name myself.

Right now I pass in the same generated name ('__'.join (field_names)) to the constructor, but this means I need to repeat that logic in any other similar application, and I would have to put in special handling if any of my attribute names required renaming.

I would rather be explicit that I'm not providing a specific name.  With your '_' suggestion it looks like a magic value - why '_'?  By specifying None, it's obvious at the call point that I'm explicitly declining to provide a name, and then the code generates a semi-meaningful name automatically.

Also, please note that I moved the place where typename is assigned to after the part where it handles the rename stuff, so the generated names automatically incorporate a suitable default and remain valid identifiers.

I'm having trouble seeing the downside here.  I'm adding one "is None" check and one line of code to the existing procedure.  I can't believe I'm the only person who has wanted to skip making up a type name but still wanted something vaguely meaningful in debug output.
History
Date User Action Args
2017-07-31 12:28:23Isaac Morlandsetrecipients: + Isaac Morland, rhettinger, steven.daprano, ethan.furman
2017-07-31 12:28:23Isaac Morlandsetmessageid: <1501504103.48.0.228111534121.issue31085@psf.upfronthosting.co.za>
2017-07-31 12:28:23Isaac Morlandlinkissue31085 messages
2017-07-31 12:28:23Isaac Morlandcreate