save dictionary to a file without brackets.

Roy Smith roy at panix.com
Fri Aug 10 01:05:38 CEST 2012


In article <ucXUr.1030527$2z2.380746 at fx19.am4>,
 Andrew Cooper <amc96 at cam.ac.uk> wrote:

> As for poor implementations,
> 
> class Foo(object):
>     def __hash__(self):
>         return 0
> 
> I seriously found that in some older code I had the misfortune of
> reading.

Python assumes you are a consenting adult.  If you wish to engage in 
activities which are hazardous to your health, so be it.  But then 
again, you could commit this particular stupidity just as easily in C++ 
or any other language which lets you define your own hash() function.


More information about the Python-list mailing list