save dictionary to a file without brackets.

Roy Smith roy at panix.com
Thu Aug 9 19:05:38 EDT 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