Test for number?

Erik Max Francis max at alcyone.com
Mon Sep 4 15:11:43 EDT 2006


Helmut Jarausch wrote:

> One step further
> 
> try:
>    eval(x+'0')
> ....

That is an exceedingly bad idea.  Type:

	__import__('sys').exit(),

in the prompt and see what happens.

You _never_ want to run `eval` on an untrusted string.  Never.

-- 
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
  San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
   Divorces are made in Heaven.
    -- Oscar Wilde



More information about the Python-list mailing list