Message299552
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. |
|
Date |
User |
Action |
Args |
2017-07-31 12:28:23 | Isaac Morland | set | recipients:
+ Isaac Morland, rhettinger, steven.daprano, ethan.furman |
2017-07-31 12:28:23 | Isaac Morland | set | messageid: <1501504103.48.0.228111534121.issue31085@psf.upfronthosting.co.za> |
2017-07-31 12:28:23 | Isaac Morland | link | issue31085 messages |
2017-07-31 12:28:23 | Isaac Morland | create | |
|