Pierre Barbier de Reuille wrote:
> (never import
> a module in a small function likely to be called in an inner-loop !)

That's good advice, but I would say "in a *time-critical* inner-loop". After 
the first import, importing a module is fast, it is just a few dictionary 
lookups (looking up the module in sys.modules) and a dictionary write (to the 
local namespace). It's only the first import that is potentially expensive.

Kent

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to