Does hashlib support a file mode?

Anssi Saari as at sci.fi
Thu Jul 7 07:29:38 EDT 2011


Mel <mwilson at the-wire.com> writes:
> def file_to_hash(path, m = hashlib.md5()):
>> hashlib.md5 *is* called once; that is when the def statement is executed.

Very interesting, I certainly wasn't clear on this. So after that def,
the created hashlib object is in the module's scope and can be
accessed via file_to_hash.__defaults__[0].


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /