[PATCH] Calculate file sha1 in block

Fredrik Lundh fredrik at pythonware.com
Sat Apr 16 18:44:31 BST 2005


> def sha_file(f):
> -    import sha

footnote: I don't know if martin's done this on purpose, but one common
reason to import modules inside functions/methods is to avoid the import
cost for command invocations that never calls the function.

(the overhead for "reimporting" a module is marginal; it boils down to a
dictionary lookup and a fast assignment to a local variable)

</F>





More information about the bazaar mailing list