import media def get_picture(): '''Let the user select a picture file, get the picture, and return it''' filename = media.choose_file() pic = media.load_picture(filename) return pic def make_sunset (pic): '''Change picture pic so that it looks like it was taken at sunset''' # Reduce the blue and green by 30% each to make # the red stand out. for pixel in pic: green = media.get_green(pixel) media.set_green(pixel, int(green * 0.7)) blue = media.get_blue(pixel) media.set_blue(pixel, int(blue * 0.7)) print 'Set a breakpoint here so we can stop and look at variables' if __name__ == '__main__': a = get_picture() b = a make_sunset(a) media.show(b) # a and b still refer to the same picture object, # but something about it has changed