Paolino wrote:
(...)
> What I'm needing as a global (in globals() or at the module level or in 
> the module namespace) is 'translate'.The rest of bindings (all,badcars 
> and table) is something which is 'polluting' the module namespace.

try this:

## yourmodule.py ##

def _setup_table():
   import string
   all=string.maketrans('','')
   badcars=all.translate(all,string.letters+string.digits)
   return string.maketrans(badcars,'_'*len(badcars))

TABLE = _setup_table()

# optional, get rid of _setup_table symbol
del _setup_table()

def translate(text):
   return text.translate(TABLE)



HTH,
deelan.

-- 
deelan, #1 fan of adriana lima!
<http://www.deelan.com/>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to