__class__ for 2.2 types

Emile van Sebille emile at fenx.com
Sun Feb 17 20:23:11 CET 2002


"Jim Dennis"
>  That's an interesting "gotchya"  I understand why 2.__class__ is a
>  syntax error (ambiguous with a float: 2.0 etc).  But I'm surprised
>  that 2 . __class__ works; the spaces seem unnatural here.
>

I was surprised by this recently as well.  It turns out the '.' is
simply a delimiter, and whitespace is allowed either side of a
delimiter.

>>> sys . path . pop ( )
'F:\\Python22\\lib\\site-packages'
>>>


--

Emile van Sebille
emile at fenx.com

---------




More information about the Python-list mailing list