Thomas Mlynarczyk <[EMAIL PROTECTED]> writes: > Hello, > > I started to write a lexer in Python -- my first attempt to do > something useful with Python (rather than trying out snippets from > tutorials). It is not complete yet, but I would like some feedback -- > I'm a Python newbie and it seems that, with Python, there is always a > simpler and better way to do it than you think. >
Hi, Adding to John's comments, I wouldn't have source as a member of the Lexer object but as an argument of the tokenise() method (which I would make public). The tokenise method would return what you currently call self.result. So it would be used like this. >>> mylexer = Lexer(tokens) >>> mylexer.tokenise(source) # Later: >>> mylexer.tokenise(another_source) -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list