View Single Post
Old Aug 14th, 2005, 6:27 PM   #6
Cerulean
Professional Programmer
 
Cerulean's Avatar
 
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4 Cerulean is on a distinguished road
Quote:
And if you are looking to make your program more user friendly, raw_input superceeds input
And if you want to make your program safe. input() calls eval on what it reads, meaning you can do:
>>> import os
>>> input("Enter a number: ")
os.remove("/")
(goodbye computer if you did that as root)
Yes, it's that unsafe.

As for the object-orientated example.. the program gains nothing from the OO. This isn't Java - use OO where it makes sense to do so, not because it looks cool
Cerulean is offline   Reply With Quote