Regular expression as dictionary key?

Nicholas FitzRoy-Dale wzdd at lardcave.net
Mon Dec 3 22:39:27 EST 2001


On  3 Dec, Martin von Loewis wrote:
> Luke <LLoeffler at home.com> writes:
> 
>> So you add a few lines to go exhaustively through the keys and 
>> accumulate matches... Still linear.  I admitedly don't know much about 
>> the C implementation of dicts, but it seems there should be a way to 
>> leverage the dict's arrangement for fast regex keys.
> 
> You mean, you can inspect every element of a set in sub-linear time? 

Ber. :) It's pretty easy to think of a data structure that could be used
to provide the (very specific type of) regex search that he's after
without inspecting every element of the set. It's just that Python dicts
can't do this. :)

-- 
- Nicholas FitzRoy-Dale
http://www.lardcave.net

Feel my three-toed wrath!
- Catie





More information about the Python-list mailing list