Am 29.09.2012 15:42, schrieb Andriy Kornatskyy:
> 
> The following doctest fails with python3.3 (it is okay for python2.4-2.7, 
> 3.2).
> 
> class adict(dict):                                                            
>                                 
>     """                                                                       
>                                
>         >>> d = adict(a=1, b=2)                                               
>                                
>         >>> d                                                                 
>                                
>         {'a': 1, 'b': 2}                                                      
>                                 
>     """                                                                       
>                                
>                                                                               
>                                
> if __name__ == "__main__":                                                    
>                                 
>     import doctest                                                            
>                                 
>     doctest.testmod() 
> 
> Please advise if that is something known.

Yes, it's caused by the hash randomization. From now on you can't rely
on the order of an unordered type like dict or set. You could replace d
with sorted(d.items()).

Christian


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to