Thank you all for the discussion and the explanations.

> Mark Dickinson

I toyed a littled bit this afternoon and I wrote a colouriser
(British spelling?) with the tokenize module. It is quite
simple and easy.

BTW, if I understand correctly the module tokenize import
the module token. So your example becomes:

>>> from cStringIO import StringIO
>>> import tokenize
>>> for tok in tokenize.generate_tokens(StringIO("print9.0").readline):
        print tokenize.tok_name[tok[0]], tok[1]

NAME print9
NUMBER .0
ENDMARKER
>>>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to