In <[EMAIL PROTECTED]>, crystalattice
wrote:

> One other question though (hope it doesn't sound silly/stupid).  Your
> suggestion to "pickle a party" using a list has me thinking:  can a
> list store class instances?

Yes of course you can store class instances in lists.

> For example, if I wanted to store a party of characters, rather than
> pickling each person separately could I put each character instance in
> a list then pickle the list?  Like this:
> 
> char1 = Character()
> char2 = Character()
> char3 = Character()
> party = [char1, char2, char3]
> file = open("partyfile.dat", "w")
> pickle.dump(party, file)

Yes that would work.

Ciao,
        Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to