"The basic idea of persistence is fairly simple. Let's say
you've got a Python program, perhaps to manage your daily to-do
list, and you want to save your application objects (your to-do
items) between uses of the program. In other words, you want to
store your objects to disk and retrieve them later. That's
persistence. To accomplish that goal you've got several options,
each with advantages and disadvantages.
"For example, you could store your object's data in some kind of
formatted text file, such as a CSV file. Or you could use a
relational database, such as Gadfly, MySQL, PostgreSQL, or DB2.
These file formats and databases are well established, and Python
has robust interfaces for all of these storage mechanisms.
"One thing these storage mechanisms all have in common is that
data is stored independent of the objects and programs that operate
on the data. The benefit is that the data then becomes available as
a shared resource for other applications. The drawback is that
allowing access to an object's data in this way violates the
object-oriented principle of encapsulation, in which an object's
data should only be accessible through its own, public
Some of the products that appear on this site are from companies from which QuinStreet receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. QuinStreet does not include all companies or all types of products available in the marketplace.