[Tutor] language aid

Alan Gauld alan.gauld at btinternet.com
Thu Feb 4 18:39:37 CET 2010

"Owain Clarke" <simbobo at cooptel.net> wrote

> I had discounted the idea of a dictionary because all the keys need to be 
> unique,

Thats true but the values can be lists and do not need to be unique.
Its probably a better starting point that search through a list looking at 
every item.

> so whether the key is the English or non-English word, it couldn't cope 
> with
> for example "too", or a similar word in the other language.

Why not? There is only one word 'too'?
I'm not sure what you see as the problem here?
I can see an issue where the word can be translated multiple ways,
but I don't see how your list of colon separated pairs is any better?
You still have the same issues to deal with - I think?

However, if you do want to pursue that route it would be better to save
the pairs as tuples rather than as x:y strings.


Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list