>> def ishexnumber(sx): >> import re > If I run this many times, as is likely in our application, does the > 'import re' chew up memory? No. Imported modules are cached in sys.modules. After the first import, 'import x' is equivalent to "x = sys.modules['x']" (or something like this).