Did I find the right examples for you? yes no

All Samples(2)  |  Call(2)  |  Derive(0)  |  Import(0)
Is the string "val" an integer, float, or string?  Return appropriate variable
of appropriate class.
If none of those castings succeed, then return 'None'.

        def typeFromString( val ):
    """
    Is the string "val" an integer, float, or string?  Return appropriate variable
    of appropriate class.
    If none of those castings succeed, then return 'None'.
    """

    try:
        return int(val)         # try as an integer
    except:
        try:
            return float(val)   # try as a float
        except:
            try:
                return str(val)  # return a string (almost every object has a __str__ method)
            except:
                log.log( "typeFromString: unhandled cast", 4 )
                return None
        


src/e/d/EDDIE-Tool-1.0.0/eddietool/common/directive.py   EDDIE-Tool(Download)
                            val = eval( 'tpldirective.args.%s' % (t) )
                            if type( val ) == type( 'STRING' ):
                                val = utils.typeFromString( val )
                            exec( 'self.args.%s = val' % (t) )
                        except:
                    val = tokdict[t]
                    if type( val ) == type( 'STRING' ):
                        val = utils.typeFromString( val )
                    exec( 'self.args.%s = val' % (t) )
                except: