__class__ for 2.2 types

Steve Holden sholden at holdenweb.com
Sun Feb 17 17:21:55 EST 2002


"Emile van Sebille" <emile at fenx.com> wrote...
> "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'
> >>>
Well, syntactically the period acts as a delimiter when there are no spaces,
but here the spaces themselves are the delimiters. Technically isn't the
period acting as an operator here, the operation being "find in namespace"
or some such?

regards
 Steve
--
Consulting, training, speaking: http://www.holdenweb.com/
Author, Python Web Programming: http://pydish.holdenweb.com/pwp/

"This is Python.  We don't care much about theory, except where it
intersects with useful practice."  Aahz Maruch on c.l.py







More information about the Python-list mailing list