colloquial names for types?

Christian Tanzer tanzer at swing.co.at
Tue Aug 27 01:36:53 EDT 2002


inyeol_lee at yahoo.com (Inyeol Lee) wrote:

> >>> {}.__class__.__name__
> 'dict'
> >>> 3.__class__.__name__
> SyntaxError: invalid syntax
> >>> dir(3)
> [ ... '__class__', ... ]
>
> I'm confused. Why 3.__class__ raises exception?

Because of:

Python 2.2.1 (#1, Jul 18 2002, 06:59:41)
[GCC 2.95.4 20011002 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 3..__class__
<type 'float'>

Try (3).__class__ to get the class of the integer 3.

-- 
Christian Tanzer                                         tanzer at swing.co.at
Glasauergasse 32                                       Tel: +43 1 876 62 36
A-1130 Vienna, Austria                                 Fax: +43 1 877 66 92





More information about the Python-list mailing list