dictionnaries and lookup tables

Steve Holden steve at holdenweb.com
Tue Oct 11 16:31:20 EDT 2005


m.barenco at gmail.com wrote:
>>Sure they're implemented.
> 
> 
> Oops, my apologies.
> 
> Just to build up on that, when I run:
> 
> #start of listing
> import random
> 
> A={1:None,2:None,"hello":None,(1,2,3):None}
> 
> def dictcomp(n):
> 	for i in range(n):
> 		B=A.copy()
> 		C=A.copy()
> 		b=random.uniform(0,1)
> 		c=random.uniform(0,1)
> 		B[b]=None
> 		C[c]=None
> 		res=((B>C)==(b>c))
> 		print res,
> 
> dictcomp(1000)
> #end of listing
> 
> I get 1000 True's on the output, which suggests that key-wise ordering
> is implemented in some guise. The question is: how do I access that?
> 
You don't. There is no ordering of the keys, so there is no way that you 
can implement the function you want.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/




More information about the Python-list mailing list