Typecasting

Erik Max Francis max at alcyone.com
Mon Feb 23 19:56:52 EST 2004


R Hughes wrote:

> No doubt someone has already suggested eval()
> as in:
> string = '555'
> number  = eval(s)

For something that is as well-defined as simply converting an integer,
int is far, far preferable to eval.  All eval does is introduce the
possibility of serious security problems if used incorrectly, whereas
int has none.

-- 
 __ Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
/  \ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
\__/ A man can stand a lot as long as he can stand himself.
    -- Axel Munthe



More information about the Python-list mailing list