[Python-ideas] Changing str(someclass) to return only the class name

Terry Reedy tjreedy at udel.edu
Sat Oct 22 06:25:27 CEST 2011


On 10/21/2011 8:39 PM, Nick Coghlan wrote:

>     str(module) ==>  module.__name__
>     str(func)  ==>  func.__name__
>     str(cls)  ==>  "{}.{}".format(cls.__module__, cls.__name__) # See note below

If you do this, then also do
str(generator) ==> generator.__name__

-- 
Terry Jan Reedy




More information about the Python-ideas mailing list