Wednesday, March 18, 2020

Sins of the Father essays

Sins of the Father essays This film is based on the true story of a relationship between Tom Cherry and his father Bobby Frank Cherry, who was a member of the Ku Klux Klan. Bobby Cherry was charged for being apart in one of the most biggest crimes in US history. This horrible tragedy happened in1963, the bombing of the Baptist Church in Birmingham that killed four young girls: Denise McNair, Addie Mae Collins, Carole Robertson and Cynthia Wesley. This film impressively recreated this event and put you in the perspective of some of the people who lived through this. It was filled with a lot of flashbacks from Toms perspective as well showing some of the things that people had to deal with at that time. The most impressive thing on the film was how at first you dont really know what is going on and why, but once you see all the flashbacks Tom thinks about you piece it all The character that impressed me most was Tom Cherry. Tom grew up living with his family and trying to make his father proud. When Tom had to do something bad in order to gain his fathers approval, you would see him hesitate at first knowing what hes is bad but still does it anyway. Such a situation happened when Tom, his brother Bobby jr. and their father were walking down a street and bump into a black man. The black man recognized that the father was from the KKK and started a fight with the father. The father took this metal rod that the black man was holding and whacked him on the head. While the black man was on the ground bleeding, the father gave Tom the rod so he could whack him. At first you see Tom hesitate knowing that it wasnt the right thing to do, but under the pressure of his father watching him he goes and whacks the black man anyway. This is when you first see that Tom really is a good person, he only does bad ...

Sunday, March 1, 2020

How to Use Pickle to Save Objects in Python

How to Use Pickle to Save Objects in Python Pickle, which is part of the Python library by default, is an important module whenever you need persistence between user sessions. As a module, pickle provides for the saving of Python objects between processes. Whether you  are programming for a database, game, forum, or some other application that must save information between sessions, pickle is useful for saving identifiers and settings. The pickle module can store things such as data types such as booleans, strings, and byte arrays, lists, dictionaries, functions, and more. Note:  The concept of pickling is also known as serialization, marshaling, and  flattening. However, the point is always the same- to save an object to a file for later retrieval. Pickling accomplishes this by writing the object as one long stream of bytes.   Pickle Example Code in Python To write an object to a file, you  use a code in the following syntax: import pickle object Object() filehandler open(filename, w) pickle.dump(object, filehandler) Heres how a real-world example  looks: import pickle import math object_pi math.pi file_pi open(filename_pi.obj, w) pickle.dump(object_pi, file_pi) This snippet writes the contents of object_pi to the file handler file_pi, which in turn is bound to the file filename_pi.obj in the directory of execution. To restore the value of the object to memory, load the object from the file. Assuming that pickle has not yet been imported for use, start by importing it: import pickle filehandler open(filename, r) object pickle.load(filehandler) The following code restores the value of pi: import pickle file_pi2 open(filename_pi.obj, r) object_pi2 pickle.load(file_pi2) The object is then ready for use once again, this time as object_pi2. You can, of course, reuse the original names, if you prefer. This example uses distinct names for clarity. Things to Remember About Pickle Keep these things in mind when using the pickle module: The pickle protocol is specific to Python – its not guaranteed to be cross-language compatible. You most likely cannot transfer the information to make it useful in Perl, PHP, Java, or other languages.There is also no guarantee of compatibility between different versions of Python. IThe incompatibility exists because not every Python data structure can be serialized by the module.By default, the latest version of the pickle protocol is used. It remains that way unless you manually change it. Tip:  Also find out  how to use shelve to save objects in Python  for another method of maintaining object continuity.