colloquial names for types?

Inyeol Lee inyeol_lee at yahoo.com
Mon Aug 26 19:05:36 CEST 2002


holger krekel <pyth at devel.trillke.net> wrote in message news:<mailman.1030295978.22776.python-list at python.org>...

> 
> I'd try using
> 
>     something.__class__.__name__

Python 2.2.1 (#1, Apr 10 2002, 18:25:16) 
[GCC 2.95.3 20010315 (release)] on sunos5

>>> "".__class__.__name__
'str'
>>> [].__class__.__name__
'list'
>>> {}.__class__.__name__
'dict'
>>> 3.__class__.__name__
SyntaxError: invalid syntax
>>> dir(3)
[ ... '__class__', ... ]

I'm confused. Why 3.__class__ raises exception?

-Inyeol Lee



More information about the Python-list mailing list