Other notes

Nick Coghlan ncoghlan at iinet.net.au
Sat Jan 8 03:22:53 EST 2005


Bengt Richter wrote:
> IOW, I think there is a fix: keep tokenizing greedily and tokenize floating point as
> a sequence of integers and operators, and let <integer><dot><integer> be translated by
> the compiler to floating point, and <integer><dotdot><integer> be translated to the
> appropriate generator expression implementation.

That would be:

<int-literal><dot><int-literal> -> float(<int-literal> + "." + <int-literal>)
<int-literal><dot><identifier> -> getattr(int(<int-literal>), <identifier>)
<int-literal><dot><dot><int-literal> -> xrange(<int-literal>, <int-literal>)

However, the problem comes when you realise that 1e3 is also a floating point 
literal, as is 1.1e3.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net



More information about the Python-list mailing list