Posts tagged python

Jun07

A Somewhat Longer Program

python | comments

If you quit from the Python interpreter and enter it again, the definitions you have made (functions and variables) are lost. Therefore, if you want to write a somewhat longer program, you are better off using a text editor to prepare the input for the interpreter and running it with that file as input instead. This is known as creating a script.
Continue reading »

Aug29

Object-Oriented File Manipulation

ruby rush python | comments

The file manipulation routines in Ruby’s stdlib are a bit of a mess. Operations are scattered among different classes - File, Dir, and FileUtils. Methods often aren’t where you expect them - like File.directory? but not Dir.directory?. But worst of all, they aren’t object-oriented. You’d want to make calls like f.size or f.directory?, but instead you’re stuck with File.stat(f).size and File.directory?(f).

Continue reading »