how to dynamically generate __name__ for an object?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Aug 7 00:47:42 EDT 2011


Eric Snow wrote:

> Thought I knew how to provide a dynamic __name__ on instances of a
> class.  My first try was to use a non-data descriptor:

Perhaps you should explain what you are trying to do. If you want to give
instances their own name, why not just give them an instance
attribute "name"? Double-leading-and-trailing-underscore attributes are
reserved for Python, and have special semantics.


-- 
Steven




More information about the Python-list mailing list