caseless dictionary howto ?

Stefan Behnel stefan.behnel-n05pAM at web.de
Wed Jun 20 04:06:57 EDT 2007


Stef Mientki wrote:
> I need to search a piece of text and make all words that are equal
> (except their case) also equal in their case, based on the first
> occurrence.
> So I'm using a dictionary to store names and attributes of objects.
> As as I need to search on the caseless name (so I've choosen lowercase),
> My dictionairy looks like this:
> 
>     self.procs [ "serial_hw_read"  ] = ( "Serial_HW_Read", "F", "++", T)

I have no idea what the "F", "++", "T" means at the end (if it's some kind of
flags or attributes, maybe a class to hold them would look better), but that's
a good solution to the problem IMHO.

Stefan



More information about the Python-list mailing list