[Tutor] unpickling a class

Timothy Wilson wilson@visi.com
Fri, 21 Dec 2001 11:11:23 -0600 (CST)


Hi everyone,

I'm going to try to ask this question in a general enough way to avoid
getting bogged down in specifics.

My students are just finishing a program that keeps track of the
performance of a collection of stocks in an investment portfolio
(http://www.isd197.org/sibley/cs/icp/assignments/portfolio_html). We're
about to start object-oriented programming (OOP) and I'm in the process
of converting my version of the portfolio program to use objects. I
thought this might make a good comparison study for them.

I'm having trouble building a constructor method for the Portfolio class
that allows me to *either* create a portfolio instance from scratch or
load one from disk using the pickle module.

Any hints or do I need to post some code?

-Tim

--
Tim Wilson      |   Visit Sibley online:   | Check out:
Henry Sibley HS |  http://www.isd197.org   | http://www.zope.com
W. St. Paul, MN |                          | http://slashdot.org
wilson@visi.com |  <dtml-var pithy_quote>  | http://linux.com