Isaac Morland added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue31085>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to