colloquial names for types?
Tim Peters
tim.one at comcast.net
Mon Aug 26 13:25:16 EDT 2002
[Inyeol Lee]
> ...
> >>> 3.__class__.__name__
> SyntaxError: invalid syntax
> >>> dir(3)
> [ ... '__class__', ... ]
>
> I'm confused. Why 3.__class__ raises exception?
It's parsed as the floating-point literal "3.", followed by the identifier
"__class__", and that's syntactically meaningless. Try, e.g., (3).__class__
instead. "3 .__class__" will also work.
More information about the Python-list
mailing list