how to dynamically generate __name__ for an object?

Steven D'Aprano steve+comp.lang.python at
Sun Aug 7 06:47:42 CEST 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.


More information about the Python-list mailing list