[RELEASED] Python 3.3.0

Christian Heimes christian at python.org
Sat Sep 29 10:06:10 EDT 2012


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





More information about the Python-list mailing list