[PYTHON-CRYPTO] Reviving PEP 247: Hashing API

Gregory P. Smith greg at ELECTRICRAIN.COM
Mon Sep 17 22:14:57 CEST 2001


On Mon, Sep 17, 2001 at 04:12:55PM -0400, Andrew Kuchling wrote:
> On Mon, Sep 17, 2001 at 11:27:14AM -0700, Bram Cohen wrote:
> >On Mon, 17 Sep 2001, Andrew Kuchling wrote:
> >I rather like how sha.sha maps to the same thing as sha.new, so you can
> >say from sha import sha, that could be extended to the other hash
> >functions as well.
>
> How come?  IMHO it's clearer to always use new() for creating a new
> object. md5.md5() or sha.sha() don't make it clear what the return
> value would be, at least in my eyes.

I agree.  I think what Bram suggested above is better written as:

from sha import new as sha

(python 2+ ism)

-G





More information about the python-crypto mailing list