Samuel wrote in news:[EMAIL PROTECTED] 
in comp.lang.python:

> Hi,
> 
> I am trying to replace the eval() in the following code:
> 
> def myfunc(type, table):
>     module   = __import__(type)
>     type     = 'module' + '.' + type
>     obj      = eval(type)
>     return obj(row[table.c.name], row[table.c.handle])
> 

>>> m = __import__( "StringIO" )
>>> x = getattr( m, "StringIO" )()
>>> x
<StringIO.StringIO instance at 0x00A47710>
>>> 

Rob.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to