Vedran Čačić added the comment:

getname sounds good, but is in fact very confusing. In most cases, what you'd 
actually want, and end up writing, is getname(type(x)), but we can't make it 
the default since for classes we would actually like x.__name__ directly. It 
seems you say the same with "get the names of various things (e.g. via 
`__class__`)", but the interface is very complicated if we try to guess what 
people meant, and clumsy if we force people to write type almost all the time.

The point is, we want to be explicit about whether we are speaking about x or 
type(x). Everything else is simply presentation details. type does it perfectly 
well, only the presentation details are canonically handled via str and repr. 
And it's perfectly natural, BTW. Imagine if str(5) gave you '<integer 5>'. :-o

----------

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

Reply via email to