Python Basic Doubt

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Aug 11 21:08:23 EDT 2013


On Sun, 11 Aug 2013 18:58:25 +0200, Xavi wrote:

> Respect to the "Names starting and ending with double-underscore". I
> don't know how to get the name of a classe without them.
> obj.__class__.__name__

I didn't say you should *never* use them, but most of the time, you don't.

However type(obj).__name__ should be better.


-- 
Steven



More information about the Python-list mailing list