Does my RE rock, or suck?

Pierre-Frédéric Caillaud peufeu at free.fr
Fri Jul 9 09:28:54 EDT 2004


	I think you need some binary search or some form of tree here.

	Make a list of prefixes, sort them, store this list somewhere it's quick  
to access.
	It is then very quick (N log N) to look in that list which key  
corresponds to the beginning of a path.
	Basically you do a bisection search and, of course you don't have an  
exact match but the last key you end up on is your prefix.

	I believe there is a btree data type in the Python library.

	

	



More information about the Python-list mailing list