[Tutor] modification

Rob Andrews rob@jam.rr.com
Mon, 20 Aug 2001 13:06:58 -0500


dman wrote:
> 
> On Mon, Aug 20, 2001 at 11:25:42AM -0500, Rob Andrews wrote:
> 
>  # use input instead of raw_input
> 
> Rob, why do you suggest using input() instead of raw_input()?
> 
> Using input() can be potentially harmful if the user is knowledgeable
> and malicious.  Suppose, for example, instead of entering a number the
> user enters in
> 
>     open( "some_file" , "w" )
> 
> In this case the file will be opened in write mode (which truncates
> its contents to nothing) and the file handle returned.  The program
> will not operate correctly because it still expects an int, not a
> file.
> 
<snip />

I would've never guessed that one. Thanks for the tip.

Rob
-- 
A {} is a terrible thing to waste.
Useless Python!
http://www.lowerstandard.com/python