type/class __repr__ formatter for Python objects I am building a list of Python objects that I use fairly regularly that have a length property, (len, 'len') and I was trying to determine the best way to simplify the type/class formatter that the object uses.  For example:
 type([]), returns "&lt; type 'list'>" and type(collections.Counter()) returns "&lt; class 'collections.Counter'> "

I had assumed that the formatter that was used could be accessed simply and the extraneous information removed to facility a particular documentation format that I prefer.  In this situation, I had hoped to be able to remove '&lt; type ... >' or '&lt; class ... >' from the resultant output.  The kludge that I have come up with entails parsing the string into its components and returning the portion I want.  To ensure generality, for objects that I may not currently use, I had hoped for a better solution.

Insights regarding options to this issue, or more general comments would be appreciated.  The line in question is flagged with a comment.  Apologies, if I am not supposed to included doc information with posted scripts.

"""
Script:   empty_tests.py
Modified: 2015-05-25
Purpose:
  checks on objects that I use, that have a __len__ property
Notes:
- collections.OrderedDictionary and other classes in collections behave
  in a similar fashion
- for NumPy arrays, use size property rather than __len__
"""
import numpy as np
import collections
c0 = collections.Counter()
c1 = collections.Counter([0])
objs = [ [],[1],(),(1),{},{1:"one"},"","1",None,True,1,False,0,c0,c1 ]
is_empty = [ True  if not i else False for i in objs ]
t = [ type(i).__name__ for i in objs ]            # correct based on comment
#t = [str(type(i)).split("\'")[1] for i in objs ] # line in question
print("\n{:&lt;15} {:&lt;6} {:&lt;10}".format("Object","Empty","Type"))
for i in range(len(objs)):
    print("{:&lt;15} {:&lt;6} {:&lt;10s}".format(objs[i],str(is_empty[i]),t[i]))


Output with the above...the commented out line worked

Object          Empty  Type      
[]              True   list      
[1]             False  list      
()              True   tuple     
1               False  int       
{}              True   dict      
{1: 'one'}      False  dict      
                True   str   
.... etc   


I have tried ....

&gt;&gt;&gt; type([])
&lt;type 'type'&gt;
&gt;&gt;&gt; repr(type([]))
&lt;type 'list'&gt;"
&gt;&gt;&gt; str(type([]))
&lt;type 'list'&gt;"
&gt;&gt;&gt; print str(type([])), repr(type([]))
&lt;type 'list'&gt; &lt;type 'list'&gt;
&gt;&gt;&gt;


EDIT
the "name" property wasn't listed where I thought it would be, so if the object has a "format" property, check there. 

&gt;&gt;&gt; help(type(object).__format__)
Help on method_descriptor:
__format__(...)
    default object formatter
&gt;&gt;&gt; dir(type(object).__format__)
    ['__call__', '__class__', '__delattr__', '__doc__', '__format__',
     '__get__', '__getattribute__', '__hash__', '__init__', '__name__', 
     '__new__', '__objclass__', '__reduce__', '__reduce_ex__', '__repr__', 
     '__setattr__', '__sizeof__', '__str__', '__subclasshook__']
    &gt;&gt;&gt;
This was answered in comments, but for completeness:


The name of a class is given by its __name__ attribute.
It's not a good idea to rely on dir to show you all the special methods and attributes. If you read the documentation you'll see that it says:


  The resulting list is not necessarily complete.


The place to look for documentation on special methods is the Data model section of the Python Language Reference.
Python 3.3 added __qualname__, which gives the qualified name, which is more informative than __name__ for nested class definitions.
__name__ doesn't include the module name, so collections.Counter.__name__ is just "Counter". If you want to prepend the module name, find it using the __module__ attribute.
True if not i else False is a long-winded way to write not i.
If possible, iterate over objects, not over indexes. Instead of:

is_empty = [ True  if not i else False for i in objs ]
t = [ type(i).__name__ for i in objs ]
for i in range(len(objs)):
    print("{:&lt;15} {:&lt;6} {:&lt;10s}".format(objs[i],str(is_empty[i]),t[i]))


write:

for obj in objs:
    print("{!r:15} {!r:6} {:10}".format(obj, not obj, type(obj).__name__))