My first Python program -- a lexer

John Machin sjmachin at lexicon.net
Tue Nov 11 00:06:41 CET 2008


On Nov 11, 8:35 am, Thomas Mlynarczyk <tho... at mlynarczyk-webdesign.de>
wrote:

> [Using dict]
>
> > No, not at all. The point is that you were not *using* any of the
> > mapping functionality of the dict object, only ancillary methods like
> > iteritems -- hence, you should not have been using a dict at all.
>
> I /could/ have done it with a list of tuples. I use no functionality
> that /only/ a dict can do. So using a dict here is like using a truck
> for transporting a single sheet of paper?

You are getting closer. A better analogy is that using a dict is like
transporting passengers along an autobahn in an aeroplane or
helicopter that never leaves the ground.



More information about the Python-list mailing list