Phlip wrote: > If I call m = md5() twice, I expect two objects. > > I am now aware that Python bends the definition of "call" based on > where the line occurs. Principle of least surprise.
Actually, in def file_to_hash(path, m = hashlib.md5()): hashlib.md5 *is* called once; that is when the def statement is executed. Later on, when file_to_hash gets called, the value of m is either used as is, as the default parameter, or is replaced for the duration of the call by another object supplied by the caller. Mel. -- http://mail.python.org/mailman/listinfo/python-list