Why not 3.__class__ ?

Skip Montanaro skip at pobox.com
Tue Sep 25 22:22:54 CEST 2001

    >> 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.

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

The float type will be subclassable in the future (if not already today in
2.2a3), at which point floating point numbers could indeed have attributes
that begin with the letter 'e' or even an attribute named 'e17'.

Skip Montanaro (skip at pobox.com)

More information about the Python-list mailing list