[Tutor] Re: newbie intro to pickle

2005-04-16 Thread Andrei
Lee Harr hotmail.com> writes: > Now my question is how do you keep people from just loading > the high score file with whatever scores they want? I'd say this is impossible particularly with Python, because cheaters could always look in the source and find out whatever you're doing to the scores

Re: [Tutor] Re: newbie intro to pickle

2005-04-16 Thread R. Alan Monroe
> Now my question is how do you keep people from just loading > the high score file with whatever scores they want? > This is not to disparage a simple (and probably very useful) > high score file. It is just something that I have been thinking > about doing myself for quite a while, but I can ne

[Tutor] Re: newbie intro to pickle

2005-04-16 Thread Lee Harr
Pickling simply converts an object to a string (unpickling does the opposite, convert a string to an object). The dump() function writes the generated string directly to a file, but you can use the dumps() function to get the generated string as such and do something else with it (e.g. put it in

Re: [Tutor] Re: newbie intro to pickle

2005-04-16 Thread Kent Johnson
Andrei wrote: Pickling is also very useful when combined with the bsddb module, because you get a fast database which functions very much like a dictionary, and in which you can put anything you like, as long as you pickle it first. import bsddb mydb = bsddb.btopen('game.db') mydb['highscores'] =

[Tutor] Re: newbie intro to pickle

2005-04-16 Thread Andrei
D. Hartley gmail.com> writes: > So the .dump command is, in effect, saving the file, correct? which > takes the object you're saving (in my case it would be > high_scorelist), and ("filename",". what is the "w" ?) Why does > the temp file you're saving into end in .pik? Pickling simply conv