How to derive a class from md5?

Paul Rubin http
Wed Jul 14 00:12:13 CEST 2004

Josef Wolf <jw at> writes:
> dir(md5) shows that md5 don't have an __init__() method so I tried to use
> its new(), with the same result.  What am I doing wrong here?

md5 isn't set up to be subclassed like that.  Better make a new
md5file class and have an md5 instance inside your md5file instances.
You can make a __getattr__ method to forward operations on md5file
instances to the internal md5 object.  There's probably also some 
metaclass tricks you could use to make that happen automagically.

More information about the Python-list mailing list