Why not 3.__class__ ?

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Tue Sep 25 15:57:32 EDT 2001


18 Sep 2001 15:21:53 +0200, Martin von Loewis <loewis at informatik.hu-berlin.de> pisze:

>> Is there any case in the grammar when a literal is directly followed
>> by an identifier?
> 
> No, but that wouldn't be the only cause of ambiguity. Consider
> "3.e17". This could be either a number in scientific notation, or the
> e17 attribute of the 3. literal.

Numbers don't have attributes named with 'e' and digits, so resolving
this ambiguity to scientific notation doesn't cause trouble to any
useful program.

I agree that this kind of disambiguation is ugly. But ugliness of
rules is the only reason against; it would work in practice.

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list