[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

[Tutor] Re: exceptions

2005-04-16 Thread Andrei
Diana Hawksworth optusnet.com.au> writes: > I have been trying to trap a string entry by raising an exception. The code follows - but the exception is > never raised. What am I doing wrong? I've snipped the code that is irrelevant to this question. > try: > self.guess = int(self.num

[Tutor] Sort a list into equal sized chunks

2005-04-16 Thread Klas Marteleur
Hi I have wrestled with a problem since last weeks knapsack discussion. This is what i want, but i cant get it into a program. I have a sorted list (for example): aList = [10,9,8,7,6,5,4,3,2,1] I have a max value (for example): maxValue=11 I have another

Re: [Tutor] high score lists

2005-04-16 Thread Kent Johnson
Chris Smith wrote: high = [(1000,"Denise"), (945,"Denise"), (883,"Denise"), (823,"Grant"), (779,"Aaron"), (702,"Pete"), (555,"Tom"), (443,"Tom"), (442,"Robin"), (404,"Pete")] for score, who in high: col1 = str(score).rjust(10) col2 = who.rjust(20).replace('

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] TKinter and things over Linux

2005-04-16 Thread Alberto Troiano
Hi everyone   I recently switch to Linux Red Hat AS 3.0 because I have to make a daemon to run in this OS and I'm having a few problems   I've struggle to replace Python 2.2(machine default) to 2.3.4 (tough but could)   Now I want to program a GUI with Tkinter but when I put the sentence from TKin

Re: [Tutor] Sort a list into equal sized chunks

2005-04-16 Thread Kent Johnson
Klas Marteleur wrote: Hi I have wrestled with a problem since last weeks knapsack discussion. This is what i want, but i cant get it into a program. I have a sorted list (for example): aList = [10,9,8,7,6,5,4,3,2,1] I have a max value (for example): maxValue

[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 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] TKinter and things over Linux

2005-04-16 Thread Alberto Troiano
Hi everyone   Sorry to bother you again but I don't know where else to go   I recently switch to Linux Red Hat AS 3.0 because I have to make a daemon to run in this OS and I'm having a few problems   I've struggle to replace Python 2.2(machine default) to 2.3.4 (tough but could)   Now I want to p

[Tutor] distutils problem

2005-04-16 Thread Paul Tremblay
I have written a script that is available at: https://sourceforge.net/projects/rtf2xml/ This script has gotten about 1600 downloads and I have not got many bug complaints. However, recently I got the bug complaint listed below. This bug--if it is one--seems to be related to the person't version

Re: [Tutor] distutils problem

2005-04-16 Thread Light
I think he may need to install python-devel. > I have written a script that is available at: > > https://sourceforge.net/projects/rtf2xml/ > > This script has gotten about 1600 downloads and I have not got many > bug complaints. However, recently I got the bug complaint listed > below. > > This bu

Re: [Tutor] distutils problem

2005-04-16 Thread Paul Tremblay
On Sat, Apr 16, 2005 at 12:58:33PM -0400, Paul Tremblay wrote: > I have written a script that is available at: > > https://sourceforge.net/projects/rtf2xml/ > > This script has gotten about 1600 downloads and I have not got many > bug complaints. However, recently I got the bug complaint listed >

[Tutor] How can I avoid cut'n'paste in this case?

2005-04-16 Thread Nigel Rowe
Greetings all, I hope someone can help me. I have two modules, both define the same set of classes (with differing implementations) and a number of utility functions that use those classes. The utility functions are identical (the differences I need are abstracted in the classes), so they

[Tutor] Has anyone ever tried to convert the textual output of the dis module to another language

2005-04-16 Thread R. Alan Monroe
Just curious. Googling for 'python "dis module" convert "another language" ' only got two hits. So maybe no one is trying it? I was just daydreaming about a native python compiler, and wondered how feasible it would be. Alan ___ Tutor maillist - Tutor

Re: [Tutor] How can I avoid cut'n'paste in this case?

2005-04-16 Thread Kent Johnson
Nigel Rowe wrote: I have two modules, both define the same set of classes (with differing implementations) and a number of utility functions that use those classes. The utility functions are identical (the differences I need are abstracted in the classes), so they are cut'n'pasted into both files.

[Tutor] Re: Eceptions

2005-04-16 Thread Diana Hawksworth
> From: "Brian van den Broek" <[EMAIL PROTECTED]> > To: "Diana Hawksworth" <[EMAIL PROTECTED]> > Cc: > Sent: Saturday, April 16, 2005 3:14 PM > Subject: Re: [Tutor] exceptions > > Diana Hawksworth said unto the world upon 2005-04-15 22:25: > > > Hello list, > > >

Re: [Tutor] TKinter and things over Linux

2005-04-16 Thread joe_schmoe
Alberto Troiano wrote: Hi everyone Sorry to bother you again but I don't know where else to go I recently switch to Linux Red Hat AS 3.0 because I have to make a daemon to run in this OS and I'm having a few problems I've struggle to replace Python 2.2(machine default) to 2.3.4 (tough but c

Re: [Tutor] TKinter and things over Linux

2005-04-16 Thread Bill Campbell
On Sat, Apr 16, 2005, joe_schmoe wrote: >Alberto Troiano wrote: >>Hi everyone >> >>Sorry to bother you again but I don't know where else to go >> >>I recently switch to Linux Red Hat AS 3.0 because I have to make a >>daemon to run in this OS and I'm having a few problems >> >>I've struggle to r

[Tutor] Re: How can I avoid cut'n'paste in this case?

2005-04-16 Thread Nigel Rowe
Kent Johnson wrote: > Nigel Rowe wrote: >> I have two modules, both define the same set of classes (with differing >> implementations) and a number of utility functions that use those >> classes. >> >> The utility functions are identical (the differences I need are >> abstracted in the classes),

[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

[Tutor] Re: How can I avoid cut'n'paste in this case?

2005-04-16 Thread Andrei
Nigel Rowe xoxy.net> writes: > >> I have two modules, both define the same set of classes (with differing > >> implementations) and a number of utility functions that use those > >> classes. > >> The utility functions are identical (the differences I need are > >> abstracted in the classes), so t

Re: [Tutor] "paused" graphic leaves a 'residue' when returning to game?

2005-04-16 Thread Liam Clarke
Hi Denise, Are you using Pygame?On 4/15/05, D. Hartley <[EMAIL PROTECTED]> wrote: Another quick question:I can pause and unpause the little game I created, and I have agraphic to display over top of the game screen when it is paused,which tells the user which key to press to unpause, right?  It's

Re: [Tutor] Has anyone ever tried to convert the textual output of thedis module to another language

2005-04-16 Thread Jacob S.
Just curious. Googling for 'python "dis module" convert "another language" ' only got two hits. So maybe no one is trying it? I was just daydreaming about a native python compiler, and wondered how feasible it would be. Well, from the way I understand the google search works, you would have to hit

Re: [Tutor] Has anyone ever tried to convert the textual output of thedis module to another language

2005-04-16 Thread R. Alan Monroe
>> Just curious. Googling for 'python "dis module" convert "another >> language" ' only got two hits. So maybe no one is trying it? I was >> just daydreaming about a native python compiler, and wondered how >> feasible it would be. > I hope that your true google search string doesn't contain the t