Re: [pygame] ideas for saving points in games

2007-09-24 Thread Eric Hunter
yeah. that's what I was thinking using a .txt file. what's pickle? On 9/24/07, Ian Mallett [EMAIL PROTECTED] wrote: On 9/23/07, Aaron Maupin [EMAIL PROTECTED] wrote: Eric Hunter wrote: You could just pickle the list. That's essentially what I used for pickle? I've always used .txt files.

Re: [pygame] ideas for saving points in games

2007-09-24 Thread David
Pickle is one of Python's serializing modules. http://docs.python.org/lib/module-pickle.html It can save and restore data, code, classes, etc... David On 9/24/07, Eric Hunter [EMAIL PROTECTED] wrote: yeah. that's what I was thinking using a .txt file. what's pickle? On 9/24/07, Ian

Re: [pygame] ideas for saving points in games

2007-09-24 Thread Aaron Maupin
Greg Ewing wrote: Pickling can be very convenient, but it ties your file format very closely to internal details of your program. Restructuring your program in any way is likely to render your existing pickled files useless. I used a dictionary as a container for saved game values and pickled

Re: [pygame] ideas for saving points in games

2007-09-24 Thread kschnee
On Tue, September 25, 2007 12:05 am, Aaron Maupin wrote: I used a dictionary as a container for saved game values and pickled the dictionary. Maybe not the best way but it worked like a charm. I find that in at least some cases, pickling is hideously inefficient, taking on the order of 10

Re: [pygame] ideas for saving points in games

2007-09-24 Thread Dave LeCompte (really)
[EMAIL PROTECTED] wrote: I find that in at least some cases, pickling is hideously inefficient, taking on the order of 10 times as much space as a different format. On the flip side, I find it enormously efficient, taking 1/10 the time to implement as some other formats. So it's a question of

Re: [pygame] ideas for saving points in games

2007-09-24 Thread Aaron Maupin
[EMAIL PROTECTED] wrote: I find that in at least some cases, pickling is hideously inefficient, taking on the order of 10 times as much space as a different format. In my case I knew the resulting file would be quite small (3K at the max), and even then I zipped it anyway. (Not for any

Re: [pygame] ideas for saving points in games

2007-09-24 Thread Ethan Glasser-Camp
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 [EMAIL PROTECTED] wrote: If you want to store a dictionary, a quick way to do that is to use text, writing a key:value pair to each line and ignoring lines that start with #. If we're just talking about our favorite serialization format, I much

Re: [pygame] ideas for saving points in games

2007-09-24 Thread David Gowers
On 9/25/07, Ethan Glasser-Camp [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 [EMAIL PROTECTED] wrote: If you want to store a dictionary, a quick way to do that is to use text, writing a key:value pair to each line and ignoring lines that start with #. If we're